Reviewed by Oliver Hunt.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jan 2009 16:57:16 +0000 (16:57 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jan 2009 16:57:16 +0000 (16:57 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=23478
        Add a test for application test resource loading failure

        * http/tests/appcache/404-resource-expected.txt: Added.
        * http/tests/appcache/404-resource.html: Added.
        * http/tests/appcache/resources/404-resource.manifest: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/appcache/404-resource-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/appcache/404-resource.html [new file with mode: 0644]
LayoutTests/http/tests/appcache/resources/404-resource.manifest [new file with mode: 0644]

index 8419afc..22c7adc 100644 (file)
@@ -1,3 +1,14 @@
+2009-01-23  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Oliver Hunt.
+
+        https://bugs.webkit.org/show_bug.cgi?id=23478
+        Add a test for application test resource loading failure
+
+        * http/tests/appcache/404-resource-expected.txt: Added.
+        * http/tests/appcache/404-resource.html: Added.
+        * http/tests/appcache/resources/404-resource.manifest: Added.
+
 2009-01-22  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Justin Garcia.
diff --git a/LayoutTests/http/tests/appcache/404-resource-expected.txt b/LayoutTests/http/tests/appcache/404-resource-expected.txt
new file mode 100644 (file)
index 0000000..a8e5dea
--- /dev/null
@@ -0,0 +1,6 @@
+Test that a missing explicit resource makes caching fail.
+
+Should say SUCCESS:
+
+SUCCESS
+
diff --git a/LayoutTests/http/tests/appcache/404-resource.html b/LayoutTests/http/tests/appcache/404-resource.html
new file mode 100644 (file)
index 0000000..d7428b7
--- /dev/null
@@ -0,0 +1,42 @@
+<html manifest="resources/404-resource.manifest">
+<body>
+<p>Test that a missing explicit resource makes caching fail.</p>
+<p>Should say SUCCESS:</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText()
+    layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById("result").innerHTML += message + "<br>";
+}
+
+function cacheCallback()
+{
+    log("FAIL: An event was dispatched on window.applicationCache, even though it was not associated with any cache yet.");
+}
+
+function timeout()
+{
+    if (applicationCache.status != applicationCache.UNCACHED) {
+        setTimeout(timeout, 100);
+        return;
+    }
+
+    log("SUCCESS");
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false);
+applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false);
+applicationCache.addEventListener('error', function() { log("error"); cacheCallback() }, false);
+
+setTimeout(timeout, 100);
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/appcache/resources/404-resource.manifest b/LayoutTests/http/tests/appcache/resources/404-resource.manifest
new file mode 100644 (file)
index 0000000..b2c066d
--- /dev/null
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+does-not-exist.txt