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

Unified Diff: LayoutTests/http/tests/appcache/fail-on-update-2.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
Index: LayoutTests/http/tests/appcache/fail-on-update-2.html
diff --git a/LayoutTests/http/tests/appcache/fail-on-update-2.html b/LayoutTests/http/tests/appcache/fail-on-update-2.html
index fa81f9d450161e60d94d82d9409655e1f0a655cc..ee856682661cdafe33dcced4da96e6b82df4c268 100644
--- a/LayoutTests/http/tests/appcache/fail-on-update-2.html
+++ b/LayoutTests/http/tests/appcache/fail-on-update-2.html
@@ -1,3 +1,4 @@
+<!DOCTYPE HTML>
<html manifest="resources/fail-on-update-2.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,19 +21,23 @@ function test()
{
clearTimeout(timeoutId);
- setManifestDeleted(true);
- applicationCache.update();
-
- // Create two subframes at different times to make hitting the race condition more likely.
- var ifr = document.createElement("iframe");
- ifr.setAttribute("src", 'resources/fail-on-update-2.html');
- document.body.appendChild(ifr);
+ setManifestDeleted(true, afterDelete);
- setTimeout(function() {
+ function afterDelete()
+ {
+ applicationCache.update();
+
+ // Create two subframes at different times to make hitting the race condition more likely.
var ifr = document.createElement("iframe");
ifr.setAttribute("src", 'resources/fail-on-update-2.html');
document.body.appendChild(ifr);
- }, 0);
+
+ setTimeout(function() {
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", 'resources/fail-on-update-2.html');
+ document.body.appendChild(ifr);
+ }, 0);
+ }
}
var subframesLeft = 2;
@@ -48,8 +57,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 | « LayoutTests/http/tests/appcache/fail-on-update.html ('k') | LayoutTests/http/tests/appcache/fail-on-update-2-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698