Chromium Code Reviews| 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" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 base::MessageLoop::current()->QuitWhenIdle(); | 30 base::MessageLoop::current()->QuitWhenIdle(); |
| 31 } | 31 } |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 typedef testing::Test ChildProcessHostTest; | 34 typedef testing::Test ChildProcessHostTest; |
| 35 | 35 |
| 36 TEST_F(ChildProcessHostTest, Basic) { | 36 TEST_F(ChildProcessHostTest, Basic) { |
| 37 base::MessageLoop message_loop( | 37 base::MessageLoop message_loop( |
| 38 scoped_ptr<base::MessagePump>(new common::MessagePumpMojo())); | 38 scoped_ptr<base::MessagePump>(new common::MessagePumpMojo())); |
| 39 | 39 |
| 40 Context context; | 40 Context context; |
|
jamesr
2014/07/28 20:11:27
any reason not to move this context c'tor up befor
tim (not reviewing)
2014/07/28 22:16:37
Oops, done.
| |
| 41 context.Init(); | |
| 41 TestChildProcessHostDelegate child_process_host_delegate; | 42 TestChildProcessHostDelegate child_process_host_delegate; |
| 42 ChildProcessHost child_process_host(&context, | 43 ChildProcessHost child_process_host(&context, |
| 43 &child_process_host_delegate, | 44 &child_process_host_delegate, |
| 44 ChildProcess::TYPE_TEST); | 45 ChildProcess::TYPE_TEST); |
| 45 child_process_host.Start(); | 46 child_process_host.Start(); |
| 46 message_loop.Run(); | 47 message_loop.Run(); |
| 47 int exit_code = child_process_host.Join(); | 48 int exit_code = child_process_host.Join(); |
| 48 VLOG(2) << "Joined child: exit_code = " << exit_code; | 49 VLOG(2) << "Joined child: exit_code = " << exit_code; |
| 49 EXPECT_EQ(0, exit_code); | 50 EXPECT_EQ(0, exit_code); |
| 50 } | 51 } |
| 51 | 52 |
| 52 } // namespace | 53 } // namespace |
| 53 } // namespace test | 54 } // namespace test |
| 54 } // namespace shell | 55 } // namespace shell |
| 55 } // namespace mojo | 56 } // namespace mojo |
| OLD | NEW |