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

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

Issue 2540833002: Deflake tests in http/tests/appcache/ when run in random order (Closed)
Patch Set: Rebased Created 4 years 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: third_party/WebKit/LayoutTests/http/tests/appcache/main-resource-redirect.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/appcache/main-resource-redirect.html b/third_party/WebKit/LayoutTests/http/tests/appcache/main-resource-redirect.html
index 0fa3d214ffc50d8229300c9d69f138390842b825..4989fdc957ca1efa3e9c1cf2db236cebb032ef78 100644
--- a/third_party/WebKit/LayoutTests/http/tests/appcache/main-resource-redirect.html
+++ b/third_party/WebKit/LayoutTests/http/tests/appcache/main-resource-redirect.html
@@ -8,21 +8,23 @@ if (window.testRunner) {
testRunner.dumpAsText();
}
-function setNetworkEnabled(state)
+function setNetworkEnabled(state, callback)
{
var req = new XMLHttpRequest;
- req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+ req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"));
req.send("");
+ req.onload = callback;
}
function test()
{
applicationCache.oncached = null;
applicationCache.onnoupdate = null;
- setNetworkEnabled(false);
- var ifr = document.createElement("iframe");
- ifr.setAttribute("src", "resources/main-resource-redirect-frame.php");
- document.body.appendChild(ifr);
+ setNetworkEnabled(false, () => {
+ var ifr = document.createElement("iframe");
+ ifr.setAttribute("src", "resources/main-resource-redirect-frame.php");
+ document.body.appendChild(ifr);
+ });
}
function done()
@@ -36,6 +38,6 @@ function done()
applicationCache.oncached=test;
applicationCache.onnoupdate=test;
-applicationCache.onerror = function() { setNetworkEnabled(true); window.location.reload(); }
+applicationCache.onerror = function() { setNetworkEnabled(true, () => { window.location.reload(); }); };
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698