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

Unified Diff: LayoutTests/http/tests/appcache/fail-on-update.html

Issue 752983002: Deflake appCache/fail-on-update* by removing sync XMLHTTPRequest warnings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/appcache/fail-on-update-2.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/appcache/fail-on-update.html
diff --git a/LayoutTests/http/tests/appcache/fail-on-update.html b/LayoutTests/http/tests/appcache/fail-on-update.html
index 94ffca3b9925d031bd8722347c5cbefe576c1d91..22b1fb7c2f94ee9d01c56bb44a8b371469214eb6 100644
--- a/LayoutTests/http/tests/appcache/fail-on-update.html
+++ b/LayoutTests/http/tests/appcache/fail-on-update.html
@@ -1,3 +1,4 @@
+<!DOCTYPE HTML>
<html manifest="resources/fail-on-update.php">
<script>
if (window.testRunner) {
@@ -5,10 +6,14 @@ if (window.testRunner) {
testRunner.waitUntilDone();
}
-function setManifestDeleted(state)
+function setManifestDeleted(state, callback)
{
var req = new XMLHttpRequest;
- req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"), false);
+ req.onreadystatechange = function() {
+ if (req.readyState == 4)
+ callback();
+ }
+ req.open("GET", "resources/fail-on-update.php?command=" + (state ? "delete" : "reset"));
req.send(null);
}
@@ -16,12 +21,16 @@ function test()
{
clearTimeout(timeoutId);
- setManifestDeleted(true);
- applicationCache.update();
- window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' +
- '<script>' +
- 'if (window.testRunner) testRunner.notifyDone();' +
- '</scri' + 'pt>';
+ setManifestDeleted(true, afterDelete);
+
+ function afterDelete()
+ {
+ applicationCache.update();
+ window.location = 'data:text/html,<p>SUCCESS: No crash.</p>' +
+ '<script>' +
+ 'if (window.testRunner) testRunner.notifyDone();' +
+ '</scri' + 'pt>';
+ }
}
function resetManifest()
@@ -31,8 +40,9 @@ function resetManifest()
return;
}
- setManifestDeleted(false);
- location.reload();
+ setManifestDeleted(false, function() {
+ location.reload();
+ });
}
applicationCache.addEventListener('noupdate', function() { setTimeout(test, 0) }, false);
« no previous file with comments | « no previous file | LayoutTests/http/tests/appcache/fail-on-update-2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698