| 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 "chrome/test/base/mojo_test_connector.h" | 5 #include "chrome/test/base/mojo_test_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 public: | 207 public: |
| 208 NativeRunnerDelegateImpl() {} | 208 NativeRunnerDelegateImpl() {} |
| 209 ~NativeRunnerDelegateImpl() override {} | 209 ~NativeRunnerDelegateImpl() override {} |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 // service_manager::NativeRunnerDelegate: | 212 // service_manager::NativeRunnerDelegate: |
| 213 void AdjustCommandLineArgumentsForTarget( | 213 void AdjustCommandLineArgumentsForTarget( |
| 214 const service_manager::Identity& target, | 214 const service_manager::Identity& target, |
| 215 base::CommandLine* command_line) override { | 215 base::CommandLine* command_line) override { |
| 216 if (target.name() != kTestName) { | 216 if (target.name() != kTestName) { |
| 217 if (target.name() == kTestRunnerName) { | 217 if (target.name() == kTestRunnerName) |
| 218 RemoveMashFromBrowserTests(command_line); | 218 RemoveMashFromBrowserTests(command_line); |
| 219 command_line->SetProgram( | |
| 220 base::CommandLine::ForCurrentProcess()->GetProgram()); | |
| 221 } | |
| 222 command_line->AppendSwitch(MojoTestConnector::kMashApp); | 219 command_line->AppendSwitch(MojoTestConnector::kMashApp); |
| 223 return; | 220 return; |
| 224 } | 221 } |
| 225 | 222 |
| 226 base::CommandLine::StringVector argv(command_line->argv()); | 223 base::CommandLine::StringVector argv(command_line->argv()); |
| 227 auto iter = | 224 auto iter = |
| 228 std::find(argv.begin(), argv.end(), FILE_PATH_LITERAL("--run-in-mash")); | 225 std::find(argv.begin(), argv.end(), FILE_PATH_LITERAL("--run-in-mash")); |
| 229 if (iter != argv.end()) | 226 if (iter != argv.end()) |
| 230 argv.erase(iter); | 227 argv.erase(iter); |
| 231 *command_line = base::CommandLine(argv); | 228 *command_line = base::CommandLine(argv); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 257 MojoTestConnector::~MojoTestConnector() {} | 254 MojoTestConnector::~MojoTestConnector() {} |
| 258 | 255 |
| 259 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( | 256 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( |
| 260 base::CommandLine* command_line, | 257 base::CommandLine* command_line, |
| 261 base::TestLauncher::LaunchOptions* test_launch_options) { | 258 base::TestLauncher::LaunchOptions* test_launch_options) { |
| 262 std::unique_ptr<MojoTestState> test_state( | 259 std::unique_ptr<MojoTestState> test_state( |
| 263 new MojoTestState(&background_service_manager_)); | 260 new MojoTestState(&background_service_manager_)); |
| 264 test_state->Init(command_line, test_launch_options); | 261 test_state->Init(command_line, test_launch_options); |
| 265 return std::move(test_state); | 262 return std::move(test_state); |
| 266 } | 263 } |
| OLD | NEW |