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

Side by Side Diff: mojo/runner/child/test_native_main.cc

Issue 1554443003: Stop linking in the old Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge and fix new flaky test Created 4 years, 11 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 | « mojo/runner/child/runner_connection.cc ('k') | mojo/runner/context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "mojo/runner/child/test_native_main.h" 5 #include "mojo/runner/child/test_native_main.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/process/launch.h" 12 #include "base/process/launch.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "mojo/edk/embedder/embedder.h"
16 #include "mojo/edk/embedder/process_delegate.h"
15 #include "mojo/message_pump/message_pump_mojo.h" 17 #include "mojo/message_pump/message_pump_mojo.h"
16 #include "mojo/runner/child/runner_connection.h" 18 #include "mojo/runner/child/runner_connection.h"
17 #include "mojo/runner/init.h" 19 #include "mojo/runner/init.h"
18 #include "mojo/shell/public/cpp/application_delegate.h" 20 #include "mojo/shell/public/cpp/application_delegate.h"
19 #include "mojo/shell/public/cpp/application_impl.h" 21 #include "mojo/shell/public/cpp/application_impl.h"
20 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
21 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
22 22
23 namespace mojo { 23 namespace mojo {
24 namespace runner { 24 namespace runner {
25 namespace { 25 namespace {
26 26
27 class ProcessDelegate : public mojo::embedder::ProcessDelegate { 27 class ProcessDelegate : public edk::ProcessDelegate {
28 public: 28 public:
29 ProcessDelegate() {} 29 ProcessDelegate() {}
30 ~ProcessDelegate() override {} 30 ~ProcessDelegate() override {}
31 31
32 private: 32 private:
33 void OnShutdownComplete() override {} 33 void OnShutdownComplete() override {}
34 34
35 DISALLOW_COPY_AND_ASSIGN(ProcessDelegate); 35 DISALLOW_COPY_AND_ASSIGN(ProcessDelegate);
36 }; 36 };
37 37
38 } // namespace 38 } // namespace
39 39
40 int TestNativeMain(mojo::ApplicationDelegate* application_delegate) { 40 int TestNativeMain(ApplicationDelegate* application_delegate) {
41 mojo::runner::WaitForDebuggerIfNecessary(); 41 runner::WaitForDebuggerIfNecessary();
42 42
43 #if !defined(OFFICIAL_BUILD) 43 #if !defined(OFFICIAL_BUILD)
44 base::debug::EnableInProcessStackDumping(); 44 base::debug::EnableInProcessStackDumping();
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 base::RouteStdioToConsole(false); 46 base::RouteStdioToConsole(false);
47 #endif 47 #endif
48 #endif 48 #endif
49 49
50 { 50 {
51 mojo::embedder::PreInitializeChildProcess(); 51 edk::PreInitializeChildProcess();
52 mojo::embedder::Init(); 52 edk::Init();
53 53
54 ProcessDelegate process_delegate; 54 ProcessDelegate process_delegate;
55 base::Thread io_thread("io_thread"); 55 base::Thread io_thread("io_thread");
56 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); 56 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0);
57 CHECK(io_thread.StartWithOptions(io_thread_options)); 57 CHECK(io_thread.StartWithOptions(io_thread_options));
58 58
59 mojo::embedder::InitIPCSupport( 59 edk::InitIPCSupport(&process_delegate, io_thread.task_runner().get());
60 mojo::embedder::ProcessType::NONE, &process_delegate,
61 io_thread.task_runner().get(), mojo::embedder::ScopedPlatformHandle());
62 60
63 mojo::InterfaceRequest<mojo::Application> application_request; 61 InterfaceRequest<Application> application_request;
64 scoped_ptr<mojo::runner::RunnerConnection> connection( 62 scoped_ptr<runner::RunnerConnection> connection(
65 mojo::runner::RunnerConnection::ConnectToRunner( 63 runner::RunnerConnection::ConnectToRunner(
66 &application_request, ScopedMessagePipeHandle())); 64 &application_request, ScopedMessagePipeHandle()));
67 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); 65 base::MessageLoop loop(common::MessagePumpMojo::Create());
68 mojo::ApplicationImpl impl(application_delegate, 66 ApplicationImpl impl(application_delegate, std::move(application_request));
69 std::move(application_request));
70 loop.Run(); 67 loop.Run();
71 68
72 mojo::embedder::ShutdownIPCSupport(); 69 edk::ShutdownIPCSupport();
73 } 70 }
74 71
75 return 0; 72 return 0;
76 } 73 }
77 74
78 } // namespace runner 75 } // namespace runner
79 } // namespace mojo 76 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/child/runner_connection.cc ('k') | mojo/runner/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698