Index: LayoutTests/http/tests/appcache/resource-redirect.html |
diff --git a/LayoutTests/http/tests/appcache/resource-redirect.html b/LayoutTests/http/tests/appcache/resource-redirect.html |
index e28c4701314ab52c47c3dea43943dc2de17b2b74..6c989c285948bce5a6291196462ee093bfc441ea 100644 |
--- a/LayoutTests/http/tests/appcache/resource-redirect.html |
+++ b/LayoutTests/http/tests/appcache/resource-redirect.html |
@@ -1,38 +1,34 @@ |
<html manifest="resources/resource-redirect.manifest"> |
-<body> |
-<p>Test that a redirect makes resource caching fail.</p> |
-<p>Should say SUCCESS:</p> |
-<div id=result></div> |
+<script src="/js-test-resources/js-test.js"></script> |
<script> |
-if (window.testRunner) { |
- testRunner.dumpAsText() |
- testRunner.waitUntilDone(); |
-} |
+var jsTestIsAsync = true; |
+description("Test that a redirect makes resource caching fail."); |
-function log(message) |
+function unexpectedCallback(eventName) |
{ |
- document.getElementById("result").innerHTML += message + "<br>"; |
+ testFailed("An unexpected " + eventName + " event was dispatched on window.applicationCache."); |
+ finishJSTest(); |
} |
-function cacheCallback() |
+function test(e) |
{ |
- log("FAIL: An unexpected event was dispatched on window.applicationCache."); |
-} |
+ shouldBe("window.applicationCache.status", "window.applicationCache.UNCACHED"); |
-function test() |
-{ |
- // Wait for cache update to finish. |
- if (window.applicationCache.status != window.applicationCache.UNCACHED) |
- log("FAILURE: Unexpected cache status: " + window.applicationCache.status); |
- else |
- log("SUCCESS"); |
+ event = e; |
+ shouldBeTrue("'reason' in event"); |
+ shouldBeTrue("'url' in event"); |
+ shouldBeTrue("'status' in event"); |
+ shouldBeTrue("'message' in event"); |
+ |
+ shouldBeEqualToString("event.reason", "resource"); |
+ shouldBeEqualToString("event.url", "http://127.0.0.1:8000/appcache/resources/resource-redirect.php"); |
+ shouldBe("event.status", "307"); |
- if (window.testRunner) |
- testRunner.notifyDone(); |
+ finishJSTest(); |
} |
-applicationCache.addEventListener('cached', function() { log("cached"); cacheCallback() }, false); |
-applicationCache.addEventListener('noupdate', function() { log("noupdate"); cacheCallback() }, false); |
+applicationCache.addEventListener('cached', function() { unexpectedCallback("cached"); }, false); |
+applicationCache.addEventListener('noupdate', function() { unexpectedCallback("noupdate"); }, false); |
applicationCache.addEventListener('error', test, false); |
</script> |