Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: LayoutTests/http/tests/appcache/resource-redirect.html

Issue 217133002: AppCache error details tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Restore missing files Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html manifest="resources/resource-redirect.manifest"> 1 <html manifest="resources/resource-redirect.manifest">
2 <body> 2 <script src="/js-test-resources/js-test.js"></script>
3 <p>Test that a redirect makes resource caching fail.</p>
4 <p>Should say SUCCESS:</p>
5 <div id=result></div>
6 <script> 3 <script>
7 if (window.testRunner) { 4 var jsTestIsAsync = true;
8 testRunner.dumpAsText() 5 description("Test that a redirect makes resource caching fail.");
9 testRunner.waitUntilDone(); 6
7 function unexpectedCallback(eventName)
8 {
9 testFailed("An unexpected " + eventName + " event was dispatched on window.a pplicationCache.");
10 finishJSTest();
10 } 11 }
11 12
12 function log(message) 13 function test(e)
13 { 14 {
14 document.getElementById("result").innerHTML += message + "<br>"; 15 shouldBe("window.applicationCache.status", "window.applicationCache.UNCACHED ");
16
17 event = e;
18 shouldBeTrue("'reason' in event");
19 shouldBeTrue("'url' in event");
20 shouldBeTrue("'status' in event");
21 shouldBeTrue("'message' in event");
22
23 shouldBeEqualToString("event.reason", "resource");
24 shouldBeEqualToString("event.url", "http://127.0.0.1:8000/appcache/resources /resource-redirect.php");
25 shouldBe("event.status", "307");
26
27 finishJSTest();
15 } 28 }
16 29
17 function cacheCallback() 30 applicationCache.addEventListener('cached', function() { unexpectedCallback("cac hed"); }, false);
18 { 31 applicationCache.addEventListener('noupdate', function() { unexpectedCallback("n oupdate"); }, false);
19 log("FAIL: An unexpected event was dispatched on window.applicationCache.");
20 }
21
22 function test()
23 {
24 // Wait for cache update to finish.
25 if (window.applicationCache.status != window.applicationCache.UNCACHED)
26 log("FAILURE: Unexpected cache status: " + window.applicationCache.statu s);
27 else
28 log("SUCCESS");
29
30 if (window.testRunner)
31 testRunner.notifyDone();
32 }
33
34 applicationCache.addEventListener('cached', function() { log("cached"); cacheCal lback() }, false);
35 applicationCache.addEventListener('noupdate', function() { log("noupdate"); cach eCallback() }, false);
36 applicationCache.addEventListener('error', test, false); 32 applicationCache.addEventListener('error', test, false);
37 33
38 </script> 34 </script>
39 </body> 35 </body>
40 </html> 36 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698