summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/top-frame-2.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/http/tests/appcache/top-frame-2.html')
-rw-r--r--LayoutTests/http/tests/appcache/top-frame-2.html25
1 files changed, 23 insertions, 2 deletions
diff --git a/LayoutTests/http/tests/appcache/top-frame-2.html b/LayoutTests/http/tests/appcache/top-frame-2.html
index c239d08..71bd468 100644
--- a/LayoutTests/http/tests/appcache/top-frame-2.html
+++ b/LayoutTests/http/tests/appcache/top-frame-2.html
@@ -16,13 +16,34 @@ function log(message)
document.getElementById("result").innerHTML += message + "<br>";
}
+function debug(message)
+{
+ // If running manually in the browser, print the sequence of events.
+ if (!window.layoutTestController)
+ log(message);
+}
+
+var receivedExpectedMessage = false;
+var receivedCheckingEvent = false;
+var receivedNoupdateEvent = false;
+
+function checkDone()
+{
+ if (receivedExpectedMessage && receivedCheckingEvent && receivedNoupdateEvent) {
+ log("SUCCESS");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+}
+
function test()
{
applicationCache.onnoupdate = null;
applicationCache.oncached = null;
// When a new main resource is associated with the cache, an update should be started.
- applicationCache.onchecking = function() { log("checking") }
+ applicationCache.onchecking = function() { debug("checking"); receivedCheckingEvent = true; checkDone(); }
+ applicationCache.onnoupdate = function() { debug("noupdate"); receivedNoupdateEvent = true; checkDone(); }
var ifr = document.createElement("iframe");
ifr.setAttribute("src", "resources/subframe-2.html");
@@ -35,7 +56,7 @@ applicationCache.oncached = function() { test() }
applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
-window.addEventListener("message", function() { log("SUCCESS"); if (window.layoutTestController) layoutTestController.notifyDone() }, false);
+window.addEventListener("message", function() { debug("message"); receivedExpectedMessage = true; checkDone(); }, false);
</script>
</body>