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

Unified Diff: content/public/test/browser_test_base.cc

Issue 2847003003: Fix SitePerProcessBrowserTest.ProcessTransferAfterError to not requiring modifying the mock HostRes… (Closed)
Patch Set: remove unnecessary include Created 3 years, 8 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
Index: content/public/test/browser_test_base.cc
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index 69afea661cdba13b2e7c856c143f02b931916293..c500db9eaa118e0a62ad98e03175dc03fc59801b 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -373,8 +373,20 @@ bool BrowserTestBase::UsingSoftwareGL() const {
}
void BrowserTestBase::InitializeNetworkProcess() {
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableNetworkService))
+ const testing::TestInfo* const test_info =
+ testing::UnitTest::GetInstance()->current_test_info();
+ bool network_service = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNetworkService);
+ // ProcessTransferAfterError is the only browser test which needs to modify
+ // the host rules (when not using the network service).
+ if (network_service ||
+ std::string(test_info->name()) != "ProcessTransferAfterError") {
+ // TODO(jam): enable this once all access to host_resolver() is in
+ // SetUpOnMainThread or before. http://crbug.com/713847
+ // host_resolver()->DisableModifications();
+ }
+
+ if (!network_service)
return;
net::RuleBasedHostResolverProc::RuleList rules = host_resolver()->GetRules();
@@ -401,10 +413,6 @@ void BrowserTestBase::InitializeNetworkProcess() {
ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
mojom::kNetworkServiceName, &network_service_test);
network_service_test->AddRules(std::move(mojo_rules));
-
- // TODO(jam): enable this once all access to host_resolver() is in
- // SetUpOnMainThread or before. http://crbug.com/713847
- // host_resolver()->DisableModifications();
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698