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

Unified Diff: chrome/test/data/extensions/api_test/webrequest/framework.js

Issue 11645021: Fix flakyness in webRequest API tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/webrequest/framework.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/framework.js b/chrome/test/data/extensions/api_test/webrequest/framework.js
index f8446a18bb53301fbade0000b89a5cfc73a9a9c7..993515041f653fb438e37e824fc2f8c39609eeb3 100644
--- a/chrome/test/data/extensions/api_test/webrequest/framework.js
+++ b/chrome/test/data/extensions/api_test/webrequest/framework.js
@@ -26,15 +26,20 @@ var ignoreUnexpected = false;
var logAllRequests = false;
function runTests(tests) {
- chrome.tabs.create({url: "about:blank"}, function(tab) {
- tabId = tab.id;
- tabIdMap = {};
- tabIdMap[tabId] = 0;
- chrome.test.getConfig(function(config) {
- testServerPort = config.testServer.port;
- chrome.test.runTests(tests);
- });
- });
+ var waitForAboutBlank = function(_, info, tab) {
+ if (info.status == "complete" && tab.url == "about:blank") {
+ tabId = tab.id;
+ tabIdMap = {};
+ tabIdMap[tabId] = 0;
+ chrome.tabs.onUpdated.removeListener(waitForAboutBlank);
+ chrome.test.getConfig(function(config) {
+ testServerPort = config.testServer.port;
+ chrome.test.runTests(tests);
+ });
+ }
+ };
+ chrome.tabs.onUpdated.addListener(waitForAboutBlank);
+ chrome.tabs.create({url: "about:blank"});
Matt Perry 2013/01/03 23:39:30 wow this API sucks :)
}
// Returns an URL from the test server, fixing up the port. Must be called
@@ -166,6 +171,7 @@ function captureEvent(name, details, callback) {
// us specify special return values per event.
var currentIndex = capturedEventData.length;
var extraOptions;
+ var retval;
battre 2012/12/19 17:57:57 we assign retval in 176 to a global variable witho
if (expectedEventData.length > currentIndex) {
retval =
expectedEventData[currentIndex].retval_function ?
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698