diff options
Diffstat (limited to 'dom/tests/mochitest/ajax/offline/test_bug445544.html')
-rw-r--r-- | dom/tests/mochitest/ajax/offline/test_bug445544.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/dom/tests/mochitest/ajax/offline/test_bug445544.html b/dom/tests/mochitest/ajax/offline/test_bug445544.html new file mode 100644 index 000000000..07929a656 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/test_bug445544.html @@ -0,0 +1,73 @@ +<html manifest="445544.cacheManifest"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=445544 +--> + +<head> +<title>Test for Bug 445544</title> + +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> +<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> + +<script type="text/javascript"> + +var gTestWin; +var gTimeoutId; + +function finish() +{ + gTestWin.close(); + OfflineTest.teardownAndFinish(); +} + +function error() +{ + OfflineTest.ok(false, "Part 2 did not successfully load."); + finish(); +} + +function part2loaded() +{ + clearTimeout(gTimeoutId); + OfflineTest.ok(true, "Part 2 successfully loaded."); + finish(); +} + +function part1loaded(appCacheStatus) +{ + OfflineTest.ok(appCacheStatus > 0, + "Part 1 successfully loaded from the application cache."); + + // Loading part 2 (which is not part of that application + // cache) should succeed... + gTestWin.location = "445544_part2.html"; + + // We won't be notified if the page fails to load, fail this test + // in 10 seconds. + gTimeoutId = setTimeout(error, 10000); +} + +function manifestUpdated() +{ + // Open a new window that will be associated with this application + // cache. This will call part1loaded(). + gTestWin = window.open("445544_part1.html"); +} + +if (OfflineTest.setup()) { + applicationCache.onerror = OfflineTest.failEvent; + applicationCache.oncached = OfflineTest.priv(manifestUpdated); +} + +SimpleTest.waitForExplicitFinish(); +SimpleTest.requestFlakyTimeout("untriaged"); + +</script> + +</head> + +<body> + +</body> +</html> |