summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/manifest-parsing.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/http/tests/appcache/manifest-parsing.html')
-rw-r--r--LayoutTests/http/tests/appcache/manifest-parsing.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/manifest-parsing.html b/LayoutTests/http/tests/appcache/manifest-parsing.html
new file mode 100644
index 0000000..46a7fdd
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/manifest-parsing.html
@@ -0,0 +1,66 @@
+<html manifest="resources/manifest-parsing.manifest">
+<body>
+<p>Test application cache manifest parsing.</p>
+<div id=result></div>
+
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function canLoad(url)
+{
+ try {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send();
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+
+function test()
+{
+ var hadError = false;
+
+ // Check that section name wasn't misparsed as resource URL.
+ if (canLoad("resources/UNKNOWN:")) {
+ log("Loaded 'UNKNOWN:'");
+ hadError = true;
+ }
+
+ // Load a resource that was in UNKNOWN section - in other words, that is not in cache.
+ if (canLoad("resources/not-in-cache.txt")) {
+ log("Loaded 'not-in-cache.txt'");
+ hadError = true;
+ }
+
+ // Load resources were specified with tricky whitespace.
+ if (!canLoad("resources/empty.txt")) {
+ log("Could not load 'empty.txt'");
+ hadError = true;
+ }
+ if (!canLoad("resources/simple.txt")) {
+ log("Could not load 'simple.txt'");
+ hadError = true;
+ }
+
+ log(hadError ? "FAILURE" : "SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+applicationCache.onnoupdate = function() { test() }
+applicationCache.oncached = function() { test() }
+
+applicationCache.onerror = function() { log("error") }
+</script>
+</body>
+</html>