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"); |
| 16 |
| 17 event = e; |
| 18 shouldBeEqualToString("event.reason", "signature"); |
| 19 shouldBeEqualToString("event.url", ""); |
| 20 shouldBe("event.status", "0"); |
| 21 shouldBeTrue("'message' in event"); |
| 22 |
| 23 finishJSTest(); |
15 } | 24 } |
16 | 25 |
17 function cacheCallback() | 26 applicationCache.addEventListener('cached', function() { unexpectedEvent("cached
"); }, false); |
18 { | 27 applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noup
date"); }, false); |
19 log("FAIL: An event was dispatched on window.applicationCache, even though i
t was not associated wuth any cache yet."); | |
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); | 28 applicationCache.addEventListener('error', test, false); |
37 | 29 |
38 </script> | 30 </script> |
39 </body> | 31 </body> |
40 </html> | 32 </html> |
OLD | NEW |