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

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

Issue 2398783002: Rename a bunch of Mojo Application stuff to reference Services. (Closed)
Patch Set: . Created 4 years, 2 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/i18n/icu_util.h" 10 #include "base/i18n/icu_util.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/process/launch.h" 13 #include "base/process/launch.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "chrome/test/base/chrome_test_launcher.h" 17 #include "chrome/test/base/chrome_test_launcher.h"
18 #include "chrome/test/base/chrome_test_suite.h" 18 #include "chrome/test/base/chrome_test_suite.h"
19 #include "chrome/test/base/mojo_test_connector.h" 19 #include "chrome/test/base/mojo_test_connector.h"
20 #include "content/public/common/mojo_shell_connection.h" 20 #include "content/public/common/service_manager_connection.h"
21 #include "content/public/test/test_launcher.h" 21 #include "content/public/test/test_launcher.h"
22 #include "mash/package/mash_packaged_service.h" 22 #include "mash/package/mash_packaged_service.h"
23 #include "services/shell/public/cpp/connector.h" 23 #include "services/shell/public/cpp/connector.h"
24 #include "services/shell/public/cpp/service.h" 24 #include "services/shell/public/cpp/service.h"
25 #include "services/shell/public/cpp/service_context.h" 25 #include "services/shell/public/cpp/service_context.h"
26 #include "services/shell/public/cpp/service_runner.h" 26 #include "services/shell/public/cpp/service_runner.h"
27 #include "services/shell/runner/common/switches.h" 27 #include "services/shell/runner/common/switches.h"
28 #include "services/shell/runner/host/child_process.h" 28 #include "services/shell/runner/host/child_process.h"
29 #include "services/shell/runner/host/child_process_base.h" 29 #include "services/shell/runner/host/child_process_base.h"
30 #include "services/shell/runner/init.h" 30 #include "services/shell/runner/init.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 mojo_test_connector_.reset(); 106 mojo_test_connector_.reset();
107 } 107 }
108 108
109 std::unique_ptr<MashTestSuite> test_suite_; 109 std::unique_ptr<MashTestSuite> test_suite_;
110 std::unique_ptr<MojoTestConnector> mojo_test_connector_; 110 std::unique_ptr<MojoTestConnector> mojo_test_connector_;
111 std::unique_ptr<mash::MashPackagedService> service_; 111 std::unique_ptr<mash::MashPackagedService> service_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); 113 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate);
114 }; 114 };
115 115
116 std::unique_ptr<content::MojoShellConnection> CreateMojoShellConnection( 116 std::unique_ptr<content::ServiceManagerConnection>
117 MashTestLauncherDelegate* delegate) { 117 CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) {
118 std::unique_ptr<content::MojoShellConnection> connection( 118 std::unique_ptr<content::ServiceManagerConnection> connection(
119 content::MojoShellConnection::Create( 119 content::ServiceManagerConnection::Create(
120 delegate->GetMojoTestConnectorForSingleProcess()->Init(), 120 delegate->GetMojoTestConnectorForSingleProcess()->Init(),
121 base::ThreadTaskRunnerHandle::Get())); 121 base::ThreadTaskRunnerHandle::Get()));
122 connection->Start(); 122 connection->Start();
123 ConnectToDefaultApps(connection->GetConnector()); 123 ConnectToDefaultApps(connection->GetConnector());
124 return connection; 124 return connection;
125 } 125 }
126 126
127 void StartChildApp(shell::mojom::ServiceRequest service_request) { 127 void StartChildApp(shell::mojom::ServiceRequest service_request) {
128 base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); 128 base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT);
129 base::RunLoop run_loop; 129 base::RunLoop run_loop;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) 163 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN)
164 base::RouteStdioToConsole(false); 164 base::RouteStdioToConsole(false);
165 #endif 165 #endif
166 *exit_code = shell::ChildProcessMain(); 166 *exit_code = shell::ChildProcessMain();
167 return true; 167 return true;
168 } 168 }
169 169
170 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); 170 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
171 MashTestLauncherDelegate delegate; 171 MashTestLauncherDelegate delegate;
172 // --single_process and no primoridal pipe token indicate we were run directly 172 // --single_process and no primoridal pipe token indicate we were run directly
173 // from the command line. In this case we have to start up MojoShellConnection 173 // from the command line. In this case we have to start up
174 // ServiceManagerConnection
174 // as though we were embedded. 175 // as though we were embedded.
175 content::MojoShellConnection::Factory shell_connection_factory; 176 content::ServiceManagerConnection::Factory shell_connection_factory;
176 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) && 177 if (command_line.HasSwitch(content::kSingleProcessTestsFlag) &&
177 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { 178 !command_line.HasSwitch(switches::kPrimordialPipeToken)) {
178 shell_connection_factory = 179 shell_connection_factory =
179 base::Bind(&CreateMojoShellConnection, &delegate); 180 base::Bind(&CreateServiceManagerConnection, &delegate);
180 content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory); 181 content::ServiceManagerConnection::SetFactoryForTest(
182 &shell_connection_factory);
181 } 183 }
182 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); 184 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
183 return true; 185 return true;
184 } 186 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | chromecast/browser/cast_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698