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

Unified Diff: content/browser/security_exploit_browsertest.cc

Issue 2630843002: Fix race in SecurityExploitBrowserTest and SiteIsolationStatsGathererBrowserTest (Closed)
Patch Set: fix tests -- can't overidde BrowserTestBase::SetUp() as it runs the test itself Created 3 years, 11 months 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 | content/child/site_isolation_stats_gatherer_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/security_exploit_browsertest.cc
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index 65e8540980716e7ecba81d4189b5264733aec369..b1da40206821de9e412651cf150597edfbf5ca8f 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -180,7 +180,11 @@ class SecurityExploitBrowserTest : public ContentBrowserTest {
SecurityExploitBrowserTest() {}
void SetUpCommandLine(base::CommandLine* command_line) override {
- ASSERT_TRUE(embedded_test_server()->Start());
+ // EmbeddedTestServer::InitializeAndListen() initializes its |base_url_|
+ // which is required below. This cannot invoke Start() however as that kicks
+ // off the "EmbeddedTestServer IO Thread" which then races with
+ // initialization in ContentBrowserTest::SetUp(), http://crbug.com/674545.
+ ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
// Add a host resolver rule to map all outgoing requests to the test server.
// This allows us to use "real" hostnames in URLs, which we can use to
@@ -194,6 +198,10 @@ class SecurityExploitBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
+ // Complete the manual Start() after ContentBrowserTest's own
+ // initialization, ref. comment on InitializeAndListen() above.
+ embedded_test_server()->StartAcceptingConnections();
+
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&net::URLRequestSlowDownloadJob::AddUrlHandler));
« no previous file with comments | « no previous file | content/child/site_isolation_stats_gatherer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698