Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: LayoutTests/http/tests/appcache/resource-redirect.html

Issue 217133002: AppCache error details tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Restore missing files Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698