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

Side by Side Diff: shell/child_process_host_unittest.cc

Issue 1146273002: Make ChildProcessHost::DoLaunch() not touch a random set of things on a different thread. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « shell/child_process_host.cc ('k') | no next file » | 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 partly tests child_main.*. 5 // Note: This file also partly tests child_main.*.
6 6
7 #include "shell/child_process_host.h" 7 #include "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 "build/build_config.h" 12 #include "build/build_config.h"
13 #include "mojo/common/message_pump_mojo.h" 13 #include "mojo/common/message_pump_mojo.h"
14 #include "mojo/public/c/system/types.h" 14 #include "mojo/public/c/system/types.h"
15 #include "mojo/public/cpp/system/message_pipe.h" 15 #include "mojo/public/cpp/system/message_pipe.h"
16 #include "shell/context.h" 16 #include "shell/context.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace shell { 19 namespace shell {
20 namespace { 20 namespace {
21 21
22 // Subclass just so we can observe |DidStart()|. 22 // Subclass just so we can observe |DidStart()|.
23 class TestChildProcessHost : public ChildProcessHost { 23 class TestChildProcessHost : public ChildProcessHost {
24 public: 24 public:
25 explicit TestChildProcessHost(Context* context) : ChildProcessHost(context) {} 25 explicit TestChildProcessHost(Context* context) : ChildProcessHost(context) {}
26 ~TestChildProcessHost() override {} 26 ~TestChildProcessHost() override {}
27 27
28 void DidStart(bool success) override { 28 void DidStart(base::Process child_process) override {
29 EXPECT_TRUE(success); 29 EXPECT_TRUE(child_process.IsValid());
30 ChildProcessHost::DidStart(success); 30 ChildProcessHost::DidStart(child_process.Pass());
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);
36 }; 36 };
37 37
38 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
39 // TODO(qsr): Multiprocess shell tests are not supported on android. 39 // TODO(qsr): Multiprocess shell tests are not supported on android.
40 #define MAYBE_StartJoin DISABLED_StartJoin 40 #define MAYBE_StartJoin DISABLED_StartJoin
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 EXPECT_EQ(MOJO_RESULT_UNKNOWN, result); 92 EXPECT_EQ(MOJO_RESULT_UNKNOWN, result);
93 int exit_code = child_process_host.Join(); 93 int exit_code = child_process_host.Join();
94 VLOG(2) << "Joined child: exit_code = " << exit_code; 94 VLOG(2) << "Joined child: exit_code = " << exit_code;
95 EXPECT_EQ(123, exit_code); 95 EXPECT_EQ(123, exit_code);
96 96
97 context.Shutdown(); 97 context.Shutdown();
98 } 98 }
99 99
100 } // namespace 100 } // namespace
101 } // namespace shell 101 } // namespace shell
OLDNEW
« no previous file with comments | « shell/child_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698