OLD | NEW |
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 "base/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 ProcessDelegate process_delegate; | 50 ProcessDelegate process_delegate; |
51 base::Thread io_thread("io_thread"); | 51 base::Thread io_thread("io_thread"); |
52 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); | 52 base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0); |
53 CHECK(io_thread.StartWithOptions(io_thread_options)); | 53 CHECK(io_thread.StartWithOptions(io_thread_options)); |
54 | 54 |
55 mojo::embedder::InitIPCSupport( | 55 mojo::embedder::InitIPCSupport( |
56 mojo::embedder::ProcessType::NONE, &process_delegate, | 56 mojo::embedder::ProcessType::NONE, &process_delegate, |
57 io_thread.task_runner().get(), mojo::embedder::ScopedPlatformHandle()); | 57 io_thread.task_runner().get(), mojo::embedder::ScopedPlatformHandle()); |
58 | 58 |
| 59 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); |
59 mojo::InterfaceRequest<mojo::Application> application_request; | 60 mojo::InterfaceRequest<mojo::Application> application_request; |
60 scoped_ptr<mojo::runner::RunnerConnection> connection( | 61 scoped_ptr<mojo::runner::RunnerConnection> connection( |
61 mojo::runner::RunnerConnection::ConnectToRunner(&application_request)); | 62 mojo::runner::RunnerConnection::ConnectToRunner( |
62 | 63 &application_request, ScopedMessagePipeHandle())); |
63 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); | |
64 { | 64 { |
65 mojo::ApplicationImpl impl(application_delegate, | 65 mojo::ApplicationImpl impl(application_delegate, |
66 application_request.Pass()); | 66 application_request.Pass()); |
67 loop.Run(); | 67 loop.Run(); |
68 } | 68 } |
69 | 69 |
70 connection.reset(); | |
71 | |
72 mojo::embedder::ShutdownIPCSupport(); | 70 mojo::embedder::ShutdownIPCSupport(); |
73 } | 71 } |
74 | 72 |
75 return 0; | 73 return 0; |
76 } | 74 } |
77 | 75 |
78 } // namespace runner | 76 } // namespace runner |
79 } // namespace mojo | 77 } // namespace mojo |
OLD | NEW |