1 <html manifest=
"resources/multi-fallback.manifest">
3 <p>Test application cache fallback entries with multiple candidates.
</p>
4 <p>Should say SUCCESS:
</p>
8 if (window
.testRunner
) {
9 testRunner
.dumpAsText();
10 testRunner
.waitUntilDone();
17 document
.getElementById("result").innerHTML
+= message
+ "<br>";
20 function setNetworkEnabled(state
)
23 var req
= new XMLHttpRequest
;
24 req
.open("GET", "/resources/network-simulator.php?command=" + (state
? "connect" : "disconnect"), false);
27 log("Cannot access network simulator URL, ex = " + ex
);
35 var req
= new XMLHttpRequest();
36 req
.open("GET", url
, false);
38 return req
.responseText
;
40 log("FAIL: Cannot load " + url
+ ", ex = " + ex
);
42 return ""; // This value should not be expected as the responseText for a url presented to this function.
46 var nonexistentURL
= "resources/does-not-exist";
50 applicationCache
.onnoupdate = function() { log("FAIL: received unexpected noupdate event") }
51 applicationCache
.oncached = function() { log("FAIL: received unexpected cached event") }
53 setNetworkEnabled(true);
55 if (load(nonexistentURL
) != "Hello, World!") {
56 log("FAIL: The longest fallback namespace wasn't used for a 404 response");
60 log(hadError
? "FAILURE" : "SUCCESS");
61 if (window
.testRunner
)
62 testRunner
.notifyDone();
65 applicationCache
.onnoupdate = function() { test() }
66 applicationCache
.oncached = function() { test() }
68 applicationCache
.onupdateready = function() { log("FAIL: received unexpected updateready event") }
69 applicationCache
.onerror = function() { log("FAIL: received unexpected error event") }