OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Note: This file also tests child_process.*. | 5 // Note: This file also tests child_process.*. |
6 | 6 |
7 #include "mojo/runner/child_process_host.h" | 7 #include "mojo/runner/child_process_host.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.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/path_service.h" | 12 #include "base/path_service.h" |
13 #include "mojo/message_pump/message_pump_mojo.h" | 13 #include "mojo/message_pump/message_pump_mojo.h" |
14 #include "mojo/runner/context.h" | 14 #include "mojo/runner/context.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace runner { | 18 namespace runner { |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Subclass just so we can observe |DidStart()|. | 21 // Subclass just so we can observe |DidStart()|. |
22 class TestChildProcessHost : public ChildProcessHost { | 22 class TestChildProcessHost : public ChildProcessHost { |
23 public: | 23 public: |
24 explicit TestChildProcessHost(Context* context) | 24 explicit TestChildProcessHost(Context* context) |
25 : ChildProcessHost(context, false, base::FilePath(), false) {} | 25 : ChildProcessHost(context, false, base::FilePath()) {} |
26 ~TestChildProcessHost() override {} | 26 ~TestChildProcessHost() override {} |
27 | 27 |
28 void DidStart(bool success) override { | 28 void DidStart(bool success) override { |
29 EXPECT_TRUE(success); | 29 EXPECT_TRUE(success); |
30 ChildProcessHost::DidStart(success); | 30 ChildProcessHost::DidStart(success); |
31 base::MessageLoop::current()->QuitWhenIdle(); | 31 base::MessageLoop::current()->QuitWhenIdle(); |
32 } | 32 } |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(TestChildProcessHost); | 35 DISALLOW_COPY_AND_ASSIGN(TestChildProcessHost); |
(...skipping 21 matching lines...) Expand all Loading... |
57 int exit_code = child_process_host.Join(); | 57 int exit_code = child_process_host.Join(); |
58 VLOG(2) << "Joined child: exit_code = " << exit_code; | 58 VLOG(2) << "Joined child: exit_code = " << exit_code; |
59 EXPECT_EQ(123, exit_code); | 59 EXPECT_EQ(123, exit_code); |
60 | 60 |
61 context.Shutdown(); | 61 context.Shutdown(); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 } // namespace runner | 65 } // namespace runner |
66 } // namespace mojo | 66 } // namespace mojo |
OLD | NEW |