Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: chrome/test/base/mojo_test_connector.cc

Issue 2775873002: Adds the ability to run chromeos with mus (Closed)
Patch Set: merge Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "chrome/common/chrome_switches.h"
17 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
18 #include "content/public/common/service_names.mojom.h" 19 #include "content/public/common/service_names.mojom.h"
19 #include "content/public/test/test_launcher.h" 20 #include "content/public/test/test_launcher.h"
20 #include "mojo/edk/embedder/embedder.h" 21 #include "mojo/edk/embedder/embedder.h"
21 #include "mojo/edk/embedder/pending_process_connection.h" 22 #include "mojo/edk/embedder/pending_process_connection.h"
22 #include "mojo/edk/embedder/platform_channel_pair.h" 23 #include "mojo/edk/embedder/platform_channel_pair.h"
23 #include "mojo/edk/embedder/scoped_ipc_support.h" 24 #include "mojo/edk/embedder/scoped_ipc_support.h"
24 #include "mojo/public/cpp/bindings/interface_request.h" 25 #include "mojo/public/cpp/bindings/interface_request.h"
25 #include "services/catalog/store.h" 26 #include "services/catalog/store.h"
26 #include "services/service_manager/background/background_service_manager.h" 27 #include "services/service_manager/background/background_service_manager.h"
(...skipping 17 matching lines...) Expand all
44 explicit MojoTestState( 45 explicit MojoTestState(
45 service_manager::BackgroundServiceManager* background_service_manager) 46 service_manager::BackgroundServiceManager* background_service_manager)
46 : background_service_manager_(background_service_manager), 47 : background_service_manager_(background_service_manager),
47 weak_factory_(this) {} 48 weak_factory_(this) {}
48 ~MojoTestState() override {} 49 ~MojoTestState() override {}
49 50
50 void Init(base::CommandLine* command_line, 51 void Init(base::CommandLine* command_line,
51 base::TestLauncher::LaunchOptions* test_launch_options) { 52 base::TestLauncher::LaunchOptions* test_launch_options) {
52 command_line->AppendSwitch(MojoTestConnector::kTestSwitch); 53 command_line->AppendSwitch(MojoTestConnector::kTestSwitch);
53 command_line->AppendSwitch(switches::kChildProcess); 54 command_line->AppendSwitch(switches::kChildProcess);
55 command_line->AppendSwitchASCII(switches::kMusConfig, switches::kMash);
54 56
55 platform_channel_ = base::MakeUnique<mojo::edk::PlatformChannelPair>(); 57 platform_channel_ = base::MakeUnique<mojo::edk::PlatformChannelPair>();
56 58
57 platform_channel_->PrepareToPassClientHandleToChildProcess( 59 platform_channel_->PrepareToPassClientHandleToChildProcess(
58 command_line, &handle_passing_info_); 60 command_line, &handle_passing_info_);
59 #if defined(OS_WIN) 61 #if defined(OS_WIN)
60 test_launch_options->inherit_handles = true; 62 test_launch_options->inherit_handles = true;
61 test_launch_options->handles_to_inherit = &handle_passing_info_; 63 test_launch_options->handles_to_inherit = &handle_passing_info_;
62 #if defined(OFFICIAL_BUILD) 64 #if defined(OFFICIAL_BUILD)
63 CHECK(false) << "Launching mojo process with inherit_handles is insecure!"; 65 CHECK(false) << "Launching mojo process with inherit_handles is insecure!";
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 MojoTestConnector::~MojoTestConnector() {} 217 MojoTestConnector::~MojoTestConnector() {}
216 218
217 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest( 219 std::unique_ptr<content::TestState> MojoTestConnector::PrepareForTest(
218 base::CommandLine* command_line, 220 base::CommandLine* command_line,
219 base::TestLauncher::LaunchOptions* test_launch_options) { 221 base::TestLauncher::LaunchOptions* test_launch_options) {
220 auto test_state = 222 auto test_state =
221 base::MakeUnique<MojoTestState>(&background_service_manager_); 223 base::MakeUnique<MojoTestState>(&background_service_manager_);
222 test_state->Init(command_line, test_launch_options); 224 test_state->Init(command_line, test_launch_options);
223 return test_state; 225 return test_state;
224 } 226 }
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698