Chromium Code Reviews| 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/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 mojo_test_connector_ = | 108 mojo_test_connector_ = |
| 109 base::MakeUnique<MojoTestConnector>(ReadCatalogManifest(), config_); | 109 base::MakeUnique<MojoTestConnector>(ReadCatalogManifest(), config_); |
| 110 mojo_test_connector_->Init(); | 110 mojo_test_connector_->Init(); |
| 111 } | 111 } |
| 112 return mojo_test_connector_->PrepareForTest( | 112 return mojo_test_connector_->PrepareForTest( |
| 113 command_line, test_launch_options, | 113 command_line, test_launch_options, |
| 114 base::BindOnce(&MashTestLauncherDelegate::OnTestProcessLaunched, | 114 base::BindOnce(&MashTestLauncherDelegate::OnTestProcessLaunched, |
| 115 base::Unretained(this))); | 115 base::Unretained(this))); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool AdjustChildProcessCommandLine( | |
| 119 base::CommandLine* command_line, | |
| 120 const base::FilePath& temp_data_dir) override { | |
| 121 bool result = ChromeTestLauncherDelegate::AdjustChildProcessCommandLine( | |
|
sky
2017/05/12 17:16:47
It doesn't seem that this override is necessary. C
jonross
2017/05/12 18:08:02
Whoops, missed this when I was removing my debuggi
jonross
2017/05/16 21:54:45
Done.
| |
| 122 command_line, temp_data_dir); | |
| 123 return result; | |
| 124 } | |
| 125 | |
| 118 void OnTestProcessLaunched() { | 126 void OnTestProcessLaunched() { |
| 119 // Start default apps after chrome, as they may try to connect to chrome on | 127 // Start default apps after chrome, as they may try to connect to chrome on |
| 120 // startup. Attempt to connect once per test in case a previous test crashed | 128 // startup. Attempt to connect once per test in case a previous test crashed |
| 121 // mash_session. | 129 // mash_session. |
| 122 mojo_test_connector_->StartService(mash::session::mojom::kServiceName); | 130 mojo_test_connector_->StartService(mash::session::mojom::kServiceName); |
| 123 } | 131 } |
| 124 | 132 |
| 125 void OnDoneRunningTests() override { | 133 void OnDoneRunningTests() override { |
| 126 // We have to shutdown this state here, while an AtExitManager is still | 134 // We have to shutdown this state here, while an AtExitManager is still |
| 127 // valid. | 135 // valid. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 146 MojoTestConnector::Config config_; | 154 MojoTestConnector::Config config_; |
| 147 | 155 |
| 148 std::unique_ptr<MashTestSuite> test_suite_; | 156 std::unique_ptr<MashTestSuite> test_suite_; |
| 149 std::unique_ptr<MojoTestConnector> mojo_test_connector_; | 157 std::unique_ptr<MojoTestConnector> mojo_test_connector_; |
| 150 | 158 |
| 151 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); | 159 DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate); |
| 152 }; | 160 }; |
| 153 | 161 |
| 154 std::unique_ptr<content::ServiceManagerConnection> | 162 std::unique_ptr<content::ServiceManagerConnection> |
| 155 CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) { | 163 CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) { |
| 164 delegate->GetMojoTestConnectorForSingleProcess()->Init(); | |
| 156 std::unique_ptr<content::ServiceManagerConnection> connection( | 165 std::unique_ptr<content::ServiceManagerConnection> connection( |
| 157 content::ServiceManagerConnection::Create( | 166 content::ServiceManagerConnection::Create( |
| 158 delegate->GetMojoTestConnectorForSingleProcess()->Init(), | 167 delegate->GetMojoTestConnectorForSingleProcess() |
| 168 ->InitBackgroundServiceManager(), | |
| 159 base::ThreadTaskRunnerHandle::Get())); | 169 base::ThreadTaskRunnerHandle::Get())); |
| 160 connection->Start(); | 170 connection->Start(); |
| 161 connection->GetConnector()->StartService(mash::session::mojom::kServiceName); | 171 connection->GetConnector()->StartService(mash::session::mojom::kServiceName); |
| 162 return connection; | 172 return connection; |
| 163 } | 173 } |
| 164 | 174 |
| 165 void StartEmbeddedService(service_manager::mojom::ServiceRequest request) { | 175 void StartEmbeddedService(service_manager::mojom::ServiceRequest request) { |
| 166 // The UI service requires this to be TYPE_UI, so we just always use TYPE_UI | 176 // The UI service requires this to be TYPE_UI, so we just always use TYPE_UI |
| 167 // for now. | 177 // for now. |
| 168 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | 178 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && | 221 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && |
| 212 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { | 222 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { |
| 213 service_manager_connection_factory = | 223 service_manager_connection_factory = |
| 214 base::Bind(&CreateServiceManagerConnection, &delegate); | 224 base::Bind(&CreateServiceManagerConnection, &delegate); |
| 215 content::ServiceManagerConnection::SetFactoryForTest( | 225 content::ServiceManagerConnection::SetFactoryForTest( |
| 216 &service_manager_connection_factory); | 226 &service_manager_connection_factory); |
| 217 } | 227 } |
| 218 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); | 228 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); |
| 219 return true; | 229 return true; |
| 220 } | 230 } |
| OLD | NEW |