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

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

Issue 313653005: Mojo: Add an extremely skeletal mojo_shell_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl upload crashed 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 | « mojo/mojo.gyp ('k') | mojo/shell/desktop/mojo_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Note: This file also tests child_process.*.
6
7 #include "mojo/shell/child_process_host.h"
8
9 #include "base/logging.h"
10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h"
12 #include "mojo/common/message_pump_mojo.h"
13 #include "mojo/shell/context.h"
14 #include "mojo/shell/shell_test_base.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16
17 namespace mojo {
18 namespace shell {
19 namespace test {
20 namespace {
21
22 class TestChildProcessHostDelegate
23 : public mojo::shell::ChildProcessHost::Delegate {
sky 2014/06/03 18:20:51 nit: Do you really need mojo_shell:: or mojo:: in
viettrungluu 2014/06/03 19:11:50 Done.
24 public:
25 TestChildProcessHostDelegate() {}
26 virtual ~TestChildProcessHostDelegate() {}
27 virtual void WillStart() OVERRIDE {
28 VLOG(2) << "TestChildProcessHostDelegate::WillStart()";
29 }
30 virtual void DidStart(bool success) OVERRIDE {
31 VLOG(2) << "TestChildProcessHostDelegate::DidStart(" << success << ")";
32 base::MessageLoop::current()->QuitWhenIdle();
33 }
34 };
35
36 typedef ShellTestBase ChildProcessHostTest;
37
38 TEST_F(ChildProcessHostTest, Basic) {
39 base::MessageLoop message_loop(
40 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo()));
41
42 mojo::shell::Context context;
43 TestChildProcessHostDelegate child_process_host_delegate;
44 mojo::shell::ChildProcessHost child_process_host(
45 &context, &child_process_host_delegate,
46 mojo::shell::ChildProcess::TYPE_TEST);
47 child_process_host.Start();
48 message_loop.Run();
49 int exit_code = child_process_host.Join();
50 VLOG(2) << "Joined child: exit_code = " << exit_code;
51 EXPECT_EQ(0, exit_code);
52 }
53
54 } // namespace
55 } // namespace test
56 } // namespace shell
57 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/shell/desktop/mojo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698