OLD | NEW |
---|---|
1 <html manifest="resources/wrong-signature-2.manifest"> | 1 <html manifest="resources/wrong-signature-2.manifest"> |
2 <body> | 2 <script src="/js-test-resources/js-test.js"></script> |
3 <p>Test that a manifest served with a wrong signature isn't treated as such.</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 manifest served with a wrong signature isn't treated as such."); |
9 testRunner.waitUntilDone(); | 6 |
7 function unexpectedEvent(name) | |
8 { | |
9 testFailed("Unexpected " + name + " event."); | |
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", "applicationCache.UNCACHED"); |
15 } | |
16 | 16 |
17 function cacheCallback() | 17 event = e; |
18 { | 18 shouldBeTrue("'reason' in event"); |
19 log("FAIL: An event was dispatched on window.applicationCache, even though i t was not associated wuth any cache yet."); | 19 shouldBeTrue("'url' in event"); |
20 } | 20 shouldBeTrue("'status' in event"); |
21 shouldBeTrue("'message' in event"); | |
21 | 22 |
22 function test() | 23 shouldBeEqualToString("event.reason", "signature"); |
23 { | 24 shouldBeEqualToString("event.url", ""); |
24 // Wait for cache update to finish. | 25 shouldBe("event.status", "0"); |
25 if (window.applicationCache.status != window.applicationCache.UNCACHED) | |
26 log("FAILURE: Unexpected cache status: " + window.applicationCache.statu s); | |
27 else | |
28 log("SUCCESS"); | |
29 | 26 |
30 if (window.testRunner) | 27 finishJSTest(); |
31 testRunner.notifyDone(); | |
32 } | 28 } |
33 | 29 |
34 applicationCache.addEventListener('cached', function() { log("cached"); cacheCal lback() }, false); | 30 applicationCache.addEventListener('cached', function() { log("cached"); cacheCal lback() }, false); |
35 applicationCache.addEventListener('noupdate', function() { log("noupdate"); cach eCallback() }, false); | 31 applicationCache.addEventListener('noupdate', function() { log("noupdate"); cach eCallback() }, false); |
michaeln
2014/03/31 20:18:43
looks like the intent is to replace cacheCallback(
jsbell
2014/03/31 22:10:45
Done.
| |
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> |
OLD | NEW |