Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: mojo/shell/child_process_host_unittest.cc

Issue 343843002: mojo: remove need for ShellTestBase::InitMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/shell/shell_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "mojo/shell/shell_test_base.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 15
17 namespace mojo { 16 namespace mojo {
18 namespace shell { 17 namespace shell {
19 namespace test { 18 namespace test {
20 namespace { 19 namespace {
21 20
22 class TestChildProcessHostDelegate : public ChildProcessHost::Delegate { 21 class TestChildProcessHostDelegate : public ChildProcessHost::Delegate {
23 public: 22 public:
24 TestChildProcessHostDelegate() {} 23 TestChildProcessHostDelegate() {}
25 virtual ~TestChildProcessHostDelegate() {} 24 virtual ~TestChildProcessHostDelegate() {}
26 virtual void WillStart() OVERRIDE { 25 virtual void WillStart() OVERRIDE {
27 VLOG(2) << "TestChildProcessHostDelegate::WillStart()"; 26 VLOG(2) << "TestChildProcessHostDelegate::WillStart()";
28 } 27 }
29 virtual void DidStart(bool success) OVERRIDE { 28 virtual void DidStart(bool success) OVERRIDE {
30 VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")"; 29 VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")";
31 base::MessageLoop::current()->QuitWhenIdle(); 30 base::MessageLoop::current()->QuitWhenIdle();
32 } 31 }
33 }; 32 };
34 33
35 typedef ShellTestBase ChildProcessHostTest; 34 typedef testing::Test ChildProcessHostTest;
36 35
37 TEST_F(ChildProcessHostTest, Basic) { 36 TEST_F(ChildProcessHostTest, Basic) {
38 base::MessageLoop message_loop( 37 base::MessageLoop message_loop(
39 scoped_ptr<base::MessagePump>(new common::MessagePumpMojo())); 38 scoped_ptr<base::MessagePump>(new common::MessagePumpMojo()));
40 39
41 Context context; 40 Context context;
42 TestChildProcessHostDelegate child_process_host_delegate; 41 TestChildProcessHostDelegate child_process_host_delegate;
43 ChildProcessHost child_process_host(&context, 42 ChildProcessHost child_process_host(&context,
44 &child_process_host_delegate, 43 &child_process_host_delegate,
45 ChildProcess::TYPE_TEST); 44 ChildProcess::TYPE_TEST);
46 child_process_host.Start(); 45 child_process_host.Start();
47 message_loop.Run(); 46 message_loop.Run();
48 int exit_code = child_process_host.Join(); 47 int exit_code = child_process_host.Join();
49 VLOG(2) << "Joined child: exit_code = " << exit_code; 48 VLOG(2) << "Joined child: exit_code = " << exit_code;
50 EXPECT_EQ(0, exit_code); 49 EXPECT_EQ(0, exit_code);
51 } 50 }
52 51
53 } // namespace 52 } // namespace
54 } // namespace test 53 } // namespace test
55 } // namespace shell 54 } // namespace shell
56 } // namespace mojo 55 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/shell/shell_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698