| OLD | NEW |
| 1 <html manifest="resources/404-resource.manifest"> | 1 <html manifest="resources/404-resource.manifest"> |
| 2 <body> | 2 <script src="/js-test-resources/js-test.js"></script> |
| 3 <p>Test that a missing explicit resource makes 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 missing explicit resource makes caching fail."); |
| 9 testRunner.waitUntilDone(); | |
| 10 } | |
| 11 | |
| 12 function log(message) | |
| 13 { | |
| 14 document.getElementById("result").innerHTML += message + "<br>"; | |
| 15 } | |
| 16 | 6 |
| 17 function unexpectedCallback(eventName) | 7 function unexpectedCallback(eventName) |
| 18 { | 8 { |
| 19 log("FAIL: An unexpected " + eventName + " event was dispatched on window.ap
plicationCache."); | 9 testFailed("An unexpected " + eventName + " event was dispatched on window.a
pplicationCache."); |
| 10 finishJSTest(); |
| 20 } | 11 } |
| 21 | 12 |
| 22 function test() | 13 function test(e) |
| 23 { | 14 { |
| 24 if (applicationCache.status == applicationCache.UNCACHED) | 15 shouldBe("applicationCache.status", "applicationCache.UNCACHED"); |
| 25 log("SUCCESS"); | |
| 26 else | |
| 27 log("FAILURE: cache status is not uncached: " + applicationCache.status)
; | |
| 28 | 16 |
| 29 if (window.testRunner) | 17 event = e; |
| 30 testRunner.notifyDone(); | 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
/does-not-exist.txt"); |
| 25 shouldBe("event.status", "404"); |
| 26 |
| 27 finishJSTest(); |
| 31 } | 28 } |
| 32 | 29 |
| 33 applicationCache.addEventListener('cached', function() { unexpectedCallback("cac
hed"); cacheCallback() }, false); | 30 applicationCache.addEventListener('cached', function() { unexpectedCallback("cac
hed"); }, false); |
| 34 applicationCache.addEventListener('noupdate', function() { unexpectedCallback("n
oupdate"); cacheCallback() }, false); | 31 applicationCache.addEventListener('noupdate', function() { unexpectedCallback("n
oupdate"); }, false); |
| 35 applicationCache.addEventListener('error', test, false); | 32 applicationCache.addEventListener('error', test, false); |
| 36 | 33 |
| 37 </script> | 34 </script> |
| 38 </body> | |
| 39 </html> | 35 </html> |
| OLD | NEW |