dom/tests/mochitest/ajax/offline/test_bug445544.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:ab03b64c7c6c
1 <html manifest="445544.cacheManifest">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=445544
4 -->
5
6 <head>
7 <title>Test for Bug 445544</title>
8
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
12
13 <script type="text/javascript">
14
15 var gTestWin;
16 var gTimeoutId;
17
18 function finish()
19 {
20 gTestWin.close();
21 OfflineTest.teardownAndFinish();
22 }
23
24 function error()
25 {
26 OfflineTest.ok(false, "Part 2 did not successfully load.");
27 finish();
28 }
29
30 function part2loaded()
31 {
32 clearTimeout(gTimeoutId);
33 OfflineTest.ok(true, "Part 2 successfully loaded.");
34 finish();
35 }
36
37 function part1loaded(appCacheStatus)
38 {
39 OfflineTest.ok(appCacheStatus > 0,
40 "Part 1 successfully loaded from the application cache.");
41
42 // Loading part 2 (which is not part of that application
43 // cache) should succeed...
44 gTestWin.location = "445544_part2.html";
45
46 // We won't be notified if the page fails to load, fail this test
47 // in 10 seconds.
48 gTimeoutId = setTimeout(error, 10000);
49 }
50
51 function manifestUpdated()
52 {
53 // Open a new window that will be associated with this application
54 // cache. This will call part1loaded().
55 gTestWin = window.open("445544_part1.html");
56 }
57
58 if (OfflineTest.setup()) {
59 applicationCache.onerror = OfflineTest.failEvent;
60 applicationCache.oncached = OfflineTest.priv(manifestUpdated);
61 }
62
63 SimpleTest.waitForExplicitFinish();
64
65 </script>
66
67 </head>
68
69 <body>
70
71 </body>
72 </html>

mercurial