| 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()); | |
| 60 mojo::InterfaceRequest<mojo::Application> application_request; | 59 mojo::InterfaceRequest<mojo::Application> application_request; |
| 61 scoped_ptr<mojo::runner::RunnerConnection> connection( | 60 scoped_ptr<mojo::runner::RunnerConnection> connection( |
| 62 mojo::runner::RunnerConnection::ConnectToRunner( | 61 mojo::runner::RunnerConnection::ConnectToRunner(&application_request)); |
| 63 &application_request, ScopedMessagePipeHandle())); | 62 |
| 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 |
| 70 mojo::embedder::ShutdownIPCSupport(); | 72 mojo::embedder::ShutdownIPCSupport(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 return 0; | 75 return 0; |
| 74 } | 76 } |
| 75 | 77 |
| 76 } // namespace runner | 78 } // namespace runner |
| 77 } // namespace mojo | 79 } // namespace mojo |
| OLD | NEW |