OLD | NEW |
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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/process/launch.h" | 11 #include "base/process/launch.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "base/threading/thread_task_runner_handle.h" | |
14 #include "chrome/test/base/chrome_test_launcher.h" | 13 #include "chrome/test/base/chrome_test_launcher.h" |
15 #include "chrome/test/base/chrome_test_suite.h" | 14 #include "chrome/test/base/chrome_test_suite.h" |
16 #include "chrome/test/base/mojo_test_connector.h" | 15 #include "chrome/test/base/mojo_test_connector.h" |
17 #include "content/public/common/mojo_shell_connection.h" | 16 #include "content/public/common/mojo_shell_connection.h" |
18 #include "content/public/test/test_launcher.h" | 17 #include "content/public/test/test_launcher.h" |
19 #include "services/shell/public/cpp/connector.h" | 18 #include "services/shell/public/cpp/connector.h" |
20 #include "services/shell/public/cpp/service.h" | 19 #include "services/shell/public/cpp/service.h" |
21 #include "services/shell/public/cpp/service_context.h" | 20 #include "services/shell/public/cpp/service_context.h" |
22 #include "services/shell/runner/common/switches.h" | 21 #include "services/shell/runner/common/switches.h" |
23 #include "services/shell/runner/host/child_process.h" | 22 #include "services/shell/runner/host/child_process.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 std::unique_ptr<shell::Service> service_; | 101 std::unique_ptr<shell::Service> service_; |
103 std::unique_ptr<shell::ServiceContext> shell_connection_; | 102 std::unique_ptr<shell::ServiceContext> shell_connection_; |
104 | 103 |
105 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); | 104 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); |
106 }; | 105 }; |
107 | 106 |
108 std::unique_ptr<content::MojoShellConnection> CreateMojoShellConnection( | 107 std::unique_ptr<content::MojoShellConnection> CreateMojoShellConnection( |
109 MashTestLauncherDelegate* delegate) { | 108 MashTestLauncherDelegate* delegate) { |
110 std::unique_ptr<content::MojoShellConnection> connection( | 109 std::unique_ptr<content::MojoShellConnection> connection( |
111 content::MojoShellConnection::Create( | 110 content::MojoShellConnection::Create( |
112 delegate->GetMojoTestConnectorForSingleProcess()->Init(), | 111 delegate->GetMojoTestConnectorForSingleProcess()->Init())); |
113 base::ThreadTaskRunnerHandle::Get())); | |
114 connection->Start(); | |
115 ConnectToDefaultApps(connection->GetConnector()); | 112 ConnectToDefaultApps(connection->GetConnector()); |
116 return connection; | 113 return connection; |
117 } | 114 } |
118 | 115 |
119 } // namespace | 116 } // namespace |
120 | 117 |
121 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { | 118 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { |
122 base::CommandLine::Init(argc, argv); | 119 base::CommandLine::Init(argc, argv); |
123 const base::CommandLine& command_line = | 120 const base::CommandLine& command_line = |
124 *base::CommandLine::ForCurrentProcess(); | 121 *base::CommandLine::ForCurrentProcess(); |
(...skipping 26 matching lines...) Expand all Loading... |
151 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { | 148 !command_line.HasSwitch(switches::kPrimordialPipeToken)) { |
152 shell_connection_factory = | 149 shell_connection_factory = |
153 base::Bind(&CreateMojoShellConnection, &delegate); | 150 base::Bind(&CreateMojoShellConnection, &delegate); |
154 content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory); | 151 content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory); |
155 } | 152 } |
156 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); | 153 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); |
157 // TODO(sky): nuke once resolve why test isn't shutting down: 594600. | 154 // TODO(sky): nuke once resolve why test isn't shutting down: 594600. |
158 LOG(ERROR) << "RunMashBrowserTests exit_code=" << *exit_code; | 155 LOG(ERROR) << "RunMashBrowserTests exit_code=" << *exit_code; |
159 return true; | 156 return true; |
160 } | 157 } |
OLD | NEW |