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