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

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

Issue 2707013003: mash: Add --use-test-config for mash_browser_tests. (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
« no previous file with comments | « no previous file | no next file » | 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 16 matching lines...) Expand all
27 #include "content/public/common/service_manager_connection.h" 27 #include "content/public/common/service_manager_connection.h"
28 #include "content/public/test/test_launcher.h" 28 #include "content/public/test/test_launcher.h"
29 #include "mash/package/mash_packaged_service.h" 29 #include "mash/package/mash_packaged_service.h"
30 #include "services/service_manager/public/cpp/connector.h" 30 #include "services/service_manager/public/cpp/connector.h"
31 #include "services/service_manager/public/cpp/service.h" 31 #include "services/service_manager/public/cpp/service.h"
32 #include "services/service_manager/public/cpp/service_context.h" 32 #include "services/service_manager/public/cpp/service_context.h"
33 #include "services/service_manager/public/cpp/service_runner.h" 33 #include "services/service_manager/public/cpp/service_runner.h"
34 #include "services/service_manager/public/cpp/standalone_service/standalone_serv ice.h" 34 #include "services/service_manager/public/cpp/standalone_service/standalone_serv ice.h"
35 #include "services/service_manager/runner/common/switches.h" 35 #include "services/service_manager/runner/common/switches.h"
36 #include "services/service_manager/runner/init.h" 36 #include "services/service_manager/runner/init.h"
37 #include "services/ui/common/switches.h"
37 #include "ui/aura/env.h" 38 #include "ui/aura/env.h"
38 39
39 namespace { 40 namespace {
40 41
41 const base::FilePath::CharType kCatalogFilename[] = 42 const base::FilePath::CharType kCatalogFilename[] =
42 FILE_PATH_LITERAL("mash_browser_tests_catalog.json"); 43 FILE_PATH_LITERAL("mash_browser_tests_catalog.json");
43 44
44 void ConnectToDefaultApps(service_manager::Connector* connector) { 45 void ConnectToDefaultApps(service_manager::Connector* connector) {
45 connector->Connect("mash_session"); 46 connector->Connect("mash_session");
46 } 47 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 base::MakeUnique<mash::MashPackagedService>(), 164 base::MakeUnique<mash::MashPackagedService>(),
164 std::move(service_request)); 165 std::move(service_request));
165 context.SetQuitClosure(run_loop.QuitClosure()); 166 context.SetQuitClosure(run_loop.QuitClosure());
166 run_loop.Run(); 167 run_loop.Run();
167 } 168 }
168 169
169 } // namespace 170 } // namespace
170 171
171 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { 172 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) {
172 base::CommandLine::Init(argc, argv); 173 base::CommandLine::Init(argc, argv);
173 const base::CommandLine& command_line = 174 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
174 *base::CommandLine::ForCurrentProcess(); 175 if (!command_line->HasSwitch("run-in-mash"))
175 if (!command_line.HasSwitch("run-in-mash"))
176 return false; 176 return false;
177 177
178 if (command_line.HasSwitch(MojoTestConnector::kMashApp)) { 178 if (command_line->HasSwitch(MojoTestConnector::kMashApp)) {
179 #if defined(OS_LINUX) 179 #if defined(OS_LINUX)
180 base::AtExitManager exit_manager; 180 base::AtExitManager exit_manager;
181 #endif 181 #endif
182 base::i18n::InitializeICU(); 182 base::i18n::InitializeICU();
183 183
184 #if !defined(OFFICIAL_BUILD) 184 #if !defined(OFFICIAL_BUILD)
185 base::debug::EnableInProcessStackDumping(); 185 base::debug::EnableInProcessStackDumping();
186 #endif 186 #endif
187 187
188 command_line->AppendSwitch(ui::switches::kUseTestConfig);
188 service_manager::RunStandaloneService(base::Bind(&StartChildApp)); 189 service_manager::RunStandaloneService(base::Bind(&StartChildApp));
189 *exit_code = 0; 190 *exit_code = 0;
190 return true; 191 return true;
191 } 192 }
192 193
193 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); 194 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
194 MashTestLauncherDelegate delegate; 195 MashTestLauncherDelegate delegate;
195 // --single_process and no primoridal pipe token indicate we were run directly 196 // --single_process and no primoridal pipe token indicate we were run directly
196 // from the command line. In this case we have to start up 197 // from the command line. In this case we have to start up
197 // ServiceManagerConnection 198 // ServiceManagerConnection
198 // as though we were embedded. 199 // as though we were embedded.
199 content::ServiceManagerConnection::Factory service_manager_connection_factory; 200 content::ServiceManagerConnection::Factory service_manager_connection_factory;
200 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && 201 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) &&
201 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { 202 !command_line->HasSwitch(switches::kPrimordialPipeToken)) {
202 service_manager_connection_factory = 203 service_manager_connection_factory =
203 base::Bind(&CreateServiceManagerConnection, &delegate); 204 base::Bind(&CreateServiceManagerConnection, &delegate);
204 content::ServiceManagerConnection::SetFactoryForTest( 205 content::ServiceManagerConnection::SetFactoryForTest(
205 &service_manager_connection_factory); 206 &service_manager_connection_factory);
206 } 207 }
207 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); 208 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
208 return true; 209 return true;
209 } 210 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698