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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest">
     1.5 +<head>
     1.6 +<title>bad manifest magic</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 +
    1.16 +function finishTest() {
    1.17 +  OfflineTest.teardownAndFinish();
    1.18 +}
    1.19 +
    1.20 +function handleError() {
    1.21 +  OfflineTest.ok(gGotChecking, "Expected checking event");
    1.22 +  OfflineTest.ok(true, "Expected error event");
    1.23 +
    1.24 +  // These items are listed in the manifest, but the error should have
    1.25 +  // prevented them from being committed to the cache.
    1.26 +  var entries = [
    1.27 +    ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false],
    1.28 +    ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false]
    1.29 +  ];
    1.30 +  OfflineTest.checkCacheEntries(entries, finishTest);
    1.31 +}
    1.32 +
    1.33 +
    1.34 +if (OfflineTest.setup()) {
    1.35 +  // Don't expect a bunch of events.
    1.36 +  applicationCache.ondownloading = OfflineTest.failEvent;
    1.37 +  applicationCache.onupdateready = OfflineTest.failEvent;
    1.38 +  applicationCache.oncached = OfflineTest.failEvent;
    1.39 +  applicationCache.onnoupdate = OfflineTest.failEvent;
    1.40 +  applicationCache.onprogress = OfflineTest.failEvent;
    1.41 +
    1.42 +  // ... but expect 'checking' and 'error'
    1.43 +  applicationCache.onchecking = function() { gGotChecking = true; };
    1.44 +  applicationCache.onerror = OfflineTest.priv(handleError);
    1.45 +}
    1.46 +
    1.47 +SimpleTest.waitForExplicitFinish();
    1.48 +
    1.49 +</script>
    1.50 +
    1.51 +</head>
    1.52 +
    1.53 +<body>
    1.54 +
    1.55 +</body>
    1.56 +</html>

mercurial