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

Side by Side Diff: chrome/test/base/mash_browser_tests_main.cc

Issue 2858103002: Have mash_browser_tests recreate BackgroundServiceManager per test (Closed)
Patch Set: Rebase Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | chrome/test/base/mojo_test_connector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/debugger.h" 9 #include "base/debug/debugger.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 MojoTestConnector::Config config_; 146 MojoTestConnector::Config config_;
147 147
148 std::unique_ptr<MashTestSuite> test_suite_; 148 std::unique_ptr<MashTestSuite> test_suite_;
149 std::unique_ptr<MojoTestConnector> mojo_test_connector_; 149 std::unique_ptr<MojoTestConnector> mojo_test_connector_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); 151 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate);
152 }; 152 };
153 153
154 std::unique_ptr<content::ServiceManagerConnection> 154 std::unique_ptr<content::ServiceManagerConnection>
155 CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) { 155 CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) {
156 delegate->GetMojoTestConnectorForSingleProcess()->Init();
156 std::unique_ptr<content::ServiceManagerConnection> connection( 157 std::unique_ptr<content::ServiceManagerConnection> connection(
157 content::ServiceManagerConnection::Create( 158 content::ServiceManagerConnection::Create(
158 delegate->GetMojoTestConnectorForSingleProcess()->Init(), 159 delegate->GetMojoTestConnectorForSingleProcess()
160 ->InitBackgroundServiceManager(),
159 base::ThreadTaskRunnerHandle::Get())); 161 base::ThreadTaskRunnerHandle::Get()));
160 connection->Start(); 162 connection->Start();
161 connection->GetConnector()->StartService(mash::session::mojom::kServiceName); 163 connection->GetConnector()->StartService(mash::session::mojom::kServiceName);
162 return connection; 164 return connection;
163 } 165 }
164 166
165 void StartEmbeddedService(service_manager::mojom::ServiceRequest request) { 167 void StartEmbeddedService(service_manager::mojom::ServiceRequest request) {
166 // The UI service requires this to be TYPE_UI, so we just always use TYPE_UI 168 // The UI service requires this to be TYPE_UI, so we just always use TYPE_UI
167 // for now. 169 // for now.
168 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 170 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && 213 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) &&
212 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { 214 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) {
213 service_manager_connection_factory = 215 service_manager_connection_factory =
214 base::Bind(&CreateServiceManagerConnection, &delegate); 216 base::Bind(&CreateServiceManagerConnection, &delegate);
215 content::ServiceManagerConnection::SetFactoryForTest( 217 content::ServiceManagerConnection::SetFactoryForTest(
216 &service_manager_connection_factory); 218 &service_manager_connection_factory);
217 } 219 }
218 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); 220 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
219 return true; 221 return true;
220 } 222 }
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_launcher.cc ('k') | chrome/test/base/mojo_test_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698