Commit 40fda43f authored by Karan Bhatia's avatar Karan Bhatia Committed by Commit Bot

WebRequest: Enable two tests to detect flakiness cause.

This CL enables two currently disabled flaky tests:
  - ExtensionWebRequestApiAuthRequiredTest.WebRequestAuthRequired
  - ExtensionWebRequestApiAuthRequiredTest.WebRequestAuthRequiredAsync

Additional debugging is added to detect the cause of flakiness. Once we get new
failure logs for these, we can hopefully find a fix.

Note for sheriffs: This is enabling flaky tests. Please paste failure logs on
the bug (from deterministic failures) before disabling the test again. Also,
prefer disabling the test to reverting this CL.

BUG=1003598

Change-Id: I921bec19f038319e4a530c3437e6582363ef694e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814867
Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699016}
parent 6e636dd8
...@@ -526,25 +526,31 @@ class ExtensionWebRequestApiAuthRequiredTest ...@@ -526,25 +526,31 @@ class ExtensionWebRequestApiAuthRequiredTest
} }
}; };
// TODO(https://crbug.com/1003598): Flake on multiple platforms. // Note: this is flaky on multiple platforms (crbug.com/1003598). Temporarily
// enabled to find flakiness cause.
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest, IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
DISABLED_WebRequestAuthRequired) { WebRequestAuthRequired) {
CancelLoginDialog login_dialog_helper; CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(StartEmbeddedTestServer());
// Pass "debug" as a custom arg to debug test flakiness.
ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags( ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
"webrequest", "test_auth_required.html", nullptr, GetFlags())) "webrequest", "test_auth_required.html", "debug", GetFlags()))
<< message_; << message_;
} }
// TODO(https://crbug.com/1003598): Flake on multiple platforms. // Note: this is flaky on multiple platforms (crbug.com/1003598). Temporarily
// enabled to find flakiness cause.
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest, IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiAuthRequiredTest,
DISABLED_WebRequestAuthRequiredAsync) { WebRequestAuthRequiredAsync) {
CancelLoginDialog login_dialog_helper; CancelLoginDialog login_dialog_helper;
ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(StartEmbeddedTestServer());
// Pass "debug" as a custom arg to debug test flakiness.
ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags( ASSERT_TRUE(RunExtensionSubtestWithArgAndFlags(
"webrequest", "test_auth_required_async.html", nullptr, GetFlags())) "webrequest", "test_auth_required_async.html", "debug", GetFlags()))
<< message_; << message_;
} }
......
...@@ -43,7 +43,7 @@ var ignoreUnexpected = false; ...@@ -43,7 +43,7 @@ var ignoreUnexpected = false;
// This is a debugging aid to print all received events as well as the // This is a debugging aid to print all received events as well as the
// information whether they were expected. // information whether they were expected.
var logAllRequests = false; var debug = false;
// Runs the |tests| using the |tab| as a default tab. // Runs the |tests| using the |tab| as a default tab.
function runTestsForTab(tests, tab) { function runTestsForTab(tests, tab) {
...@@ -60,7 +60,14 @@ function runTestsForTab(tests, tab) { ...@@ -60,7 +60,14 @@ function runTestsForTab(tests, tab) {
// Creates an "about:blank" tab and runs |tests| with this tab as default. // Creates an "about:blank" tab and runs |tests| with this tab as default.
function runTests(tests) { function runTests(tests) {
chrome.test.getConfig(function(config) { chrome.test.getConfig(function(config) {
if (config.customArg == 'debug')
debug = true;
var waitForAboutBlank = function(_, info, tab) { var waitForAboutBlank = function(_, info, tab) {
if (debug) {
console.log("tabs.OnUpdated received in waitForAboutBlank: " +
JSON.stringify(info) + " " + JSON.stringify(tab));
}
if (info.status == "complete" && tab.url == "about:blank") { if (info.status == "complete" && tab.url == "about:blank") {
chrome.tabs.onUpdated.removeListener(waitForAboutBlank); chrome.tabs.onUpdated.removeListener(waitForAboutBlank);
runTestsForTab(tests, tab); runTestsForTab(tests, tab);
...@@ -119,6 +126,10 @@ function getServerDomain(navigationType, opt_host, opt_scheme) { ...@@ -119,6 +126,10 @@ function getServerDomain(navigationType, opt_host, opt_scheme) {
function navigateAndWait(url, callback) { function navigateAndWait(url, callback) {
var done = chrome.test.listenForever(chrome.tabs.onUpdated, var done = chrome.test.listenForever(chrome.tabs.onUpdated,
function (_, info, tab) { function (_, info, tab) {
if (debug) {
console.log("tabs.OnUpdated received in navigateAndWait: " +
JSON.stringify(info) + " " + JSON.stringify(tab));
}
if (tab.id == tabId && info.status == "complete") { if (tab.id == tabId && info.status == "complete") {
if (callback) callback(tab); if (callback) callback(tab);
done(); done();
...@@ -372,8 +383,9 @@ function captureEvent(name, details, callback) { ...@@ -372,8 +383,9 @@ function captureEvent(name, details, callback) {
var retval; var retval;
var retval_function; var retval_function;
if (matchingExpectedEvent) { if (matchingExpectedEvent) {
if (logAllRequests) { if (debug) {
console.log("Expected: " + name + ": " + JSON.stringify(details)); console.log("Expected event received: " + name + ": " +
JSON.stringify(details));
} }
capturedEventData.push( capturedEventData.push(
{label: matchingExpectedEvent.label, event: name, details: details}); {label: matchingExpectedEvent.label, event: name, details: details});
...@@ -387,8 +399,9 @@ function captureEvent(name, details, callback) { ...@@ -387,8 +399,9 @@ function captureEvent(name, details, callback) {
retval = matchingExpectedEvent.retval; retval = matchingExpectedEvent.retval;
retval_function = matchingExpectedEvent.retval_function; retval_function = matchingExpectedEvent.retval_function;
} else { } else {
if (logAllRequests) { if (debug) {
console.log('NOT Expected: ' + name + ': ' + JSON.stringify(details)); console.log('NOT Expected event received: ' + name + ': ' +
JSON.stringify(details));
} }
capturedUnexpectedData.push({event: name, details: details}); capturedUnexpectedData.push({event: name, details: details});
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment