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

Unified Diff: content/utility/utility_service_factory.cc

Issue 2837813004: Sync the browser test host resolver with the network process before a test runs. (Closed)
Patch Set: review comments 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
« no previous file with comments | « content/utility/utility_service_factory.h ('k') | net/dns/mock_host_resolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/utility/utility_service_factory.cc
diff --git a/content/utility/utility_service_factory.cc b/content/utility/utility_service_factory.cc
index 73c2cf8e242ec6c5af2eb1b5ce7287bfc60aa711..734fdebd587cd6bff7c43b0644918fc0daa12f29 100644
--- a/content/utility/utility_service_factory.cc
+++ b/content/utility/utility_service_factory.cc
@@ -34,7 +34,8 @@ std::unique_ptr<service_manager::Service> CreateDataDecoderService() {
} // namespace
-UtilityServiceFactory::UtilityServiceFactory() {}
+UtilityServiceFactory::UtilityServiceFactory()
+ : network_registry_(base::MakeUnique<service_manager::BinderRegistry>()) {}
UtilityServiceFactory::~UtilityServiceFactory() {}
@@ -59,8 +60,11 @@ void UtilityServiceFactory::RegisterServices(ServiceMap* services) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNetworkService)) {
+ GetContentClient()->utility()->RegisterNetworkBinders(
+ network_registry_.get());
ServiceInfo network_info;
- network_info.factory = base::Bind(&NetworkService::CreateNetworkService);
+ network_info.factory = base::Bind(
+ &UtilityServiceFactory::CreateNetworkService, base::Unretained(this));
network_info.task_runner = ChildProcess::current()->io_task_runner();
services->insert(
std::make_pair(content::mojom::kNetworkServiceName, network_info));
@@ -78,4 +82,9 @@ void UtilityServiceFactory::OnLoadFailed() {
utility_thread->ReleaseProcessIfNeeded();
}
+std::unique_ptr<service_manager::Service>
+UtilityServiceFactory::CreateNetworkService() {
+ return base::MakeUnique<NetworkService>(std::move(network_registry_));
+}
+
} // namespace content
« no previous file with comments | « content/utility/utility_service_factory.h ('k') | net/dns/mock_host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698