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/shell/child_process_host.h" | 7 #include "mojo/shell/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 "mojo/common/message_pump_mojo.h" | 12 #include "mojo/common/message_pump_mojo.h" |
13 #include "mojo/shell/context.h" | 13 #include "mojo/shell/context.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace shell { | 17 namespace shell { |
18 namespace { | 18 namespace { |
19 | 19 |
20 // Subclass just so we can observe |DidStart()|. | 20 // Subclass just so we can observe |DidStart()|. |
21 class TestChildProcessHost : public ChildProcessHost { | 21 class TestChildProcessHost : public ChildProcessHost { |
22 public: | 22 public: |
23 explicit TestChildProcessHost(Context* context) : ChildProcessHost(context) {} | 23 explicit TestChildProcessHost(Context* context) |
| 24 : ChildProcessHost(context, "test") {} |
24 ~TestChildProcessHost() override {} | 25 ~TestChildProcessHost() override {} |
25 | 26 |
26 void DidStart(bool success) override { | 27 void DidStart(bool success) override { |
27 EXPECT_TRUE(success); | 28 EXPECT_TRUE(success); |
28 ChildProcessHost::DidStart(success); | 29 ChildProcessHost::DidStart(success); |
29 base::MessageLoop::current()->QuitWhenIdle(); | 30 base::MessageLoop::current()->QuitWhenIdle(); |
30 } | 31 } |
31 | 32 |
32 private: | 33 private: |
33 DISALLOW_COPY_AND_ASSIGN(TestChildProcessHost); | 34 DISALLOW_COPY_AND_ASSIGN(TestChildProcessHost); |
(...skipping 19 matching lines...) Expand all Loading... |
53 int exit_code = child_process_host.Join(); | 54 int exit_code = child_process_host.Join(); |
54 VLOG(2) << "Joined child: exit_code = " << exit_code; | 55 VLOG(2) << "Joined child: exit_code = " << exit_code; |
55 EXPECT_EQ(123, exit_code); | 56 EXPECT_EQ(123, exit_code); |
56 | 57 |
57 context.Shutdown(); | 58 context.Shutdown(); |
58 } | 59 } |
59 | 60 |
60 } // namespace | 61 } // namespace |
61 } // namespace shell | 62 } // namespace shell |
62 } // namespace mojo | 63 } // namespace mojo |
OLD | NEW |