| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 base::TestLauncher::LaunchOptions* test_launch_options) { | 48 base::TestLauncher::LaunchOptions* test_launch_options) { |
| 49 command_line->AppendSwitch(MojoTestConnector::kTestSwitch); | 49 command_line->AppendSwitch(MojoTestConnector::kTestSwitch); |
| 50 command_line->AppendSwitch(switches::kChildProcess); | 50 command_line->AppendSwitch(switches::kChildProcess); |
| 51 mojo_ipc_channel_.reset(new mojo::edk::PlatformChannelPair); | 51 mojo_ipc_channel_.reset(new mojo::edk::PlatformChannelPair); |
| 52 mojo_ipc_channel_->PrepareToPassClientHandleToChildProcess( | 52 mojo_ipc_channel_->PrepareToPassClientHandleToChildProcess( |
| 53 command_line, &handle_passing_info_); | 53 command_line, &handle_passing_info_); |
| 54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
| 55 test_launch_options->inherit_handles = true; | 55 test_launch_options->inherit_handles = true; |
| 56 test_launch_options->handles_to_inherit = &handle_passing_info_; | 56 test_launch_options->handles_to_inherit = &handle_passing_info_; |
| 57 #if defined(OFFICIAL_BUILD) | 57 #if defined(OFFICIAL_BUILD) |
| 58 CHECK(false) << "Launching mojo process with inherit_handles is insecure!"; | 58 // Launching mojo process with inherit_handles is insecure! |
| 59 CHECK(false); |
| 59 #endif | 60 #endif |
| 60 #elif defined(OS_POSIX) | 61 #elif defined(OS_POSIX) |
| 61 test_launch_options->fds_to_remap = &handle_passing_info_; | 62 test_launch_options->fds_to_remap = &handle_passing_info_; |
| 62 #else | 63 #else |
| 63 #error "Unsupported" | 64 #error "Unsupported" |
| 64 #endif | 65 #endif |
| 65 service_manager::mojom::ServicePtr service = | 66 service_manager::mojom::ServicePtr service = |
| 66 service_manager::PassServiceRequestOnCommandLine(command_line, | 67 service_manager::PassServiceRequestOnCommandLine(command_line, |
| 67 child_token_); | 68 child_token_); |
| 68 | 69 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 MojoTestConnector::~MojoTestConnector() {} | 255 MojoTestConnector::~MojoTestConnector() {} |
| 255 | 256 |
| 256 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( | 257 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( |
| 257 base::CommandLine* command_line, | 258 base::CommandLine* command_line, |
| 258 base::TestLauncher::LaunchOptions* test_launch_options) { | 259 base::TestLauncher::LaunchOptions* test_launch_options) { |
| 259 std::unique_ptr<MojoTestState> test_state( | 260 std::unique_ptr<MojoTestState> test_state( |
| 260 new MojoTestState(&background_service_manager_)); | 261 new MojoTestState(&background_service_manager_)); |
| 261 test_state->Init(command_line, test_launch_options); | 262 test_state->Init(command_line, test_launch_options); |
| 262 return std::move(test_state); | 263 return std::move(test_state); |
| 263 } | 264 } |
| OLD | NEW |