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

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

Issue 2701883002: service_manager: More consistent Service lifecycle API (Closed)
Patch Set: . Created 3 years, 10 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 void StartChildApp(service_manager::mojom::ServiceRequest service_request) { 157 void StartChildApp(service_manager::mojom::ServiceRequest service_request) {
158 // The UI service requires this to be TYPE_UI. We don't know which service 158 // The UI service requires this to be TYPE_UI. We don't know which service
159 // we're going to run yet, so we just always use TYPE_UI for now. 159 // we're going to run yet, so we just always use TYPE_UI for now.
160 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 160 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
161 base::RunLoop run_loop; 161 base::RunLoop run_loop;
162 service_manager::ServiceContext context( 162 service_manager::ServiceContext context(
163 base::MakeUnique<mash::MashPackagedService>(), 163 base::MakeUnique<mash::MashPackagedService>(),
164 std::move(service_request)); 164 std::move(service_request));
165 context.SetConnectionLostClosure(run_loop.QuitClosure()); 165 context.SetQuitClosure(run_loop.QuitClosure());
166 run_loop.Run(); 166 run_loop.Run();
167 } 167 }
168 168
169 } // namespace 169 } // namespace
170 170
171 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { 171 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) {
172 base::CommandLine::Init(argc, argv); 172 base::CommandLine::Init(argc, argv);
173 const base::CommandLine& command_line = 173 const base::CommandLine& command_line =
174 *base::CommandLine::ForCurrentProcess(); 174 *base::CommandLine::ForCurrentProcess();
175 if (!command_line.HasSwitch("run-in-mash")) 175 if (!command_line.HasSwitch("run-in-mash"))
(...skipping 24 matching lines...) Expand all
200 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && 200 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) &&
201 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { 201 !command_line.HasSwitch(switches::kPrimordialPipeToken)) {
202 service_manager_connection_factory = 202 service_manager_connection_factory =
203 base::Bind(&CreateServiceManagerConnection, &delegate); 203 base::Bind(&CreateServiceManagerConnection, &delegate);
204 content::ServiceManagerConnection::SetFactoryForTest( 204 content::ServiceManagerConnection::SetFactoryForTest(
205 &service_manager_connection_factory); 205 &service_manager_connection_factory);
206 } 206 }
207 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); 207 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
208 return true; 208 return true;
209 } 209 }
OLDNEW
« no previous file with comments | « chrome/app/mash/mash_runner.cc ('k') | content/common/service_manager/embedded_service_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698