1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/ajax/offline/test_identicalManifest.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"> 1.5 +<head> 1.6 +<title>identical manifest test</title> 1.7 + 1.8 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 +<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script> 1.10 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 + 1.12 +<script type="text/javascript"> 1.13 + 1.14 +var gGotChecking = false; 1.15 +var gGotDownloading = false; 1.16 + 1.17 +function finishTest() 1.18 +{ 1.19 + OfflineTest.teardownAndFinish(); 1.20 +} 1.21 + 1.22 +function noUpdate() 1.23 +{ 1.24 + OfflineTest.ok(gGotChecking, "Should get a checking event"); 1.25 + OfflineTest.ok(!gGotDownloading, "Should not get a downloading event"); 1.26 + 1.27 + var entries = [ 1.28 + // The document that requested the manifest should be in the cache 1.29 + [window.location.href, true], 1.30 + 1.31 + ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], 1.32 + ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true] 1.33 + ]; 1.34 + OfflineTest.checkCacheEntries(entries, finishTest); 1.35 +} 1.36 + 1.37 +function manifestUpdated() 1.38 +{ 1.39 + OfflineTest.ok(gGotChecking, "Should get a checking event"); 1.40 + OfflineTest.ok(gGotDownloading, "Should get a downloading event"); 1.41 + 1.42 + var entries = [ 1.43 + // The manifest itself should be in the cache 1.44 + ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest", true], 1.45 + 1.46 + // The document that requested the manifest should be in the cache 1.47 + [window.location.href, true], 1.48 + 1.49 + // The entries from the manifest should be in the cache 1.50 + ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", true], 1.51 + ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", true], 1.52 + 1.53 + // The bad entries from the manifest should not be in the cache 1.54 + ["bad:/uri/invalid", false] 1.55 + ]; 1.56 + OfflineTest.checkCacheEntries(entries, manifestUpdatedContinue); 1.57 +} 1.58 + 1.59 +function manifestUpdatedContinue() 1.60 +{ 1.61 + // Now make sure applicationCache.update() does what we expect. 1.62 + applicationCache.oncached = OfflineTest.failEvent; 1.63 + applicationCache.onnoupdate = OfflineTest.priv(noUpdate); 1.64 + 1.65 + gGotChecking = false; 1.66 + gGotDownloading = false; 1.67 + applicationCache.update(); 1.68 +} 1.69 + 1.70 +if (OfflineTest.setup()) { 1.71 + applicationCache.onerror = OfflineTest.failEvent; 1.72 + applicationCache.onnoupdate = OfflineTest.failEvent; 1.73 + applicationCache.onudpateready = OfflineTest.failEvent; 1.74 + 1.75 + applicationCache.onchecking = function() { gGotChecking = true; }; 1.76 + applicationCache.ondownloading = function() { gGotDownloading = true; }; 1.77 + applicationCache.oncached = OfflineTest.priv(manifestUpdated); 1.78 +} 1.79 + 1.80 +SimpleTest.waitForExplicitFinish(); 1.81 + 1.82 +</script> 1.83 + 1.84 +</head> 1.85 + 1.86 +<body> 1.87 + 1.88 +</body> 1.89 +</html>