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

Unified Diff: content/child/site_isolation_stats_gatherer_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 | « content/browser/security_exploit_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/site_isolation_stats_gatherer_browsertest.cc
diff --git a/content/child/site_isolation_stats_gatherer_browsertest.cc b/content/child/site_isolation_stats_gatherer_browsertest.cc
index 852ddabe0454d9294114a97f7658e068699aa16d..9150a97a046ab302d62251d72f585819fb6dc4ae 100644
--- a/content/child/site_isolation_stats_gatherer_browsertest.cc
+++ b/content/child/site_isolation_stats_gatherer_browsertest.cc
@@ -29,7 +29,12 @@ class SiteIsolationStatsGathererBrowserTest : public ContentBrowserTest {
~SiteIsolationStatsGathererBrowserTest() override {}
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
// create arbitrary SiteInstances.
@@ -43,6 +48,12 @@ class SiteIsolationStatsGathererBrowserTest : public ContentBrowserTest {
command_line->AppendSwitch(switches::kDisableWebSecurity);
}
+ void SetUpOnMainThread() override {
+ // Complete the manual Start() after ContentBrowserTest's own
+ // initialization, ref. comment on InitializeAndListen() above.
+ embedded_test_server()->StartAcceptingConnections();
+ }
+
void InspectHistograms(const base::HistogramTester& histograms,
bool should_be_blocked,
const std::string& resource_name) {
« no previous file with comments | « content/browser/security_exploit_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698