|
1 <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest"> |
|
2 <head> |
|
3 <title>unknown section</title> |
|
4 |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="text/javascript"> |
|
10 |
|
11 var gGotChecking = false; |
|
12 var gGotDownloading = false; |
|
13 |
|
14 function manifestUpdated() |
|
15 { |
|
16 OfflineTest.ok(gGotChecking, "Should get a checking event"); |
|
17 OfflineTest.ok(gGotDownloading, "Should get a downloading event"); |
|
18 |
|
19 OfflineTest.is(applicationCache.status, 1, "Cache status should be 1 (CACHED)"); |
|
20 |
|
21 var entries = [ |
|
22 // The manifest itself should be in the cache |
|
23 ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/unknownSection.cacheManifest", true], |
|
24 |
|
25 // The document that requested the manifest should be in the cache |
|
26 [window.location.href, true], |
|
27 |
|
28 // The entries from the manifest should be in the cache |
|
29 ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], |
|
30 ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true], |
|
31 |
|
32 // The bad entries from the manifest should not be in the cache |
|
33 ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/jupiter.jpg", false] |
|
34 ]; |
|
35 OfflineTest.checkCacheEntries( |
|
36 entries, |
|
37 function() { |
|
38 OfflineTest.teardownAndFinish(); |
|
39 }); |
|
40 } |
|
41 |
|
42 if (OfflineTest.setup()) { |
|
43 OfflineTest.ok(applicationCache instanceof EventTarget, |
|
44 "applicationCache should be an event target"); |
|
45 |
|
46 applicationCache.onerror = OfflineTest.failEvent; |
|
47 |
|
48 applicationCache.addEventListener("checking", function() { |
|
49 // We should get the "checking" event during an initial update, |
|
50 // but until we are associated it will not affect applicationCache.status |
|
51 OfflineTest.is(applicationCache.status, applicationCache.UNCACHED, |
|
52 "CHECKING state during initial update"); |
|
53 gGotChecking = true; |
|
54 }, true); |
|
55 applicationCache.ondownloading = function() { |
|
56 // We should get the "downloading" event during an initial update, |
|
57 // but until we are associated it will not affect applicationCache.status |
|
58 OfflineTest.is(applicationCache.status, applicationCache.UNCACHED, |
|
59 "DOWNLOADING state during initial update") |
|
60 gGotDownloading = true; }; |
|
61 applicationCache.oncached = OfflineTest.priv(manifestUpdated); |
|
62 } |
|
63 |
|
64 SimpleTest.waitForExplicitFinish(); |
|
65 |
|
66 </script> |
|
67 |
|
68 </head> |
|
69 |
|
70 <body> |
|
71 |
|
72 </body> |
|
73 </html> |