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

Side by Side Diff: shell/child_process_host_unittest.cc

Issue 1341873002: Enabling 64-bit mojo shell to launch 32-bit child to handle nonsfi content. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Anonymous namespaces and modified target names Created 5 years, 3 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') | shell/out_of_process_native_runner.cc » ('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 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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #define MAYBE_StartJoin StartJoin 42 #define MAYBE_StartJoin StartJoin
43 #endif // defined(OS_ANDROID) 43 #endif // defined(OS_ANDROID)
44 // Just tests starting the child process and joining it (without starting an 44 // Just tests starting the child process and joining it (without starting an
45 // app). 45 // app).
46 TEST(ChildProcessHostTest, MAYBE_StartJoin) { 46 TEST(ChildProcessHostTest, MAYBE_StartJoin) {
47 Context context; 47 Context context;
48 base::MessageLoop message_loop( 48 base::MessageLoop message_loop(
49 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo())); 49 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo()));
50 context.Init(); 50 context.Init();
51 TestChildProcessHost child_process_host(&context); 51 TestChildProcessHost child_process_host(&context);
52 child_process_host.Start(); 52 child_process_host.Start(false /* require_32_bit */);
53 message_loop.Run(); // This should run until |DidStart()|. 53 message_loop.Run(); // This should run until |DidStart()|.
54 child_process_host.ExitNow(123); 54 child_process_host.ExitNow(123);
55 int exit_code = child_process_host.Join(); 55 int exit_code = child_process_host.Join();
56 VLOG(2) << "Joined child: exit_code = " << exit_code; 56 VLOG(2) << "Joined child: exit_code = " << exit_code;
57 EXPECT_EQ(123, exit_code); 57 EXPECT_EQ(123, exit_code);
58 58
59 context.Shutdown(); 59 context.Shutdown();
60 } 60 }
61 61
62 #if defined(OS_ANDROID) 62 #if defined(OS_ANDROID)
63 // TODO(qsr): Multiprocess shell tests are not supported on android. 63 // TODO(qsr): Multiprocess shell tests are not supported on android.
64 #define MAYBE_ConnectionError DISABLED_ConnectionError 64 #define MAYBE_ConnectionError DISABLED_ConnectionError
65 #else 65 #else
66 #define MAYBE_ConnectionError ConnectionError 66 #define MAYBE_ConnectionError ConnectionError
67 #endif // defined(OS_ANDROID) 67 #endif // defined(OS_ANDROID)
68 // Tests that even on connection error, the callback to |StartApp()| will get 68 // Tests that even on connection error, the callback to |StartApp()| will get
69 // called. 69 // called.
70 TEST(ChildProcessHostTest, MAYBE_ConnectionError) { 70 TEST(ChildProcessHostTest, MAYBE_ConnectionError) {
71 Context context; 71 Context context;
72 base::MessageLoop message_loop( 72 base::MessageLoop message_loop(
73 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo())); 73 scoped_ptr<base::MessagePump>(new mojo::common::MessagePumpMojo()));
74 context.Init(); 74 context.Init();
75 TestChildProcessHost child_process_host(&context); 75 TestChildProcessHost child_process_host(&context);
76 child_process_host.Start(); 76 child_process_host.Start(false /* require_32_bit */);
77 message_loop.Run(); // This should run until |DidStart()|. 77 message_loop.Run(); // This should run until |DidStart()|.
78 // Send |ExitNow()| first, so that the |StartApp()| below won't actually be 78 // Send |ExitNow()| first, so that the |StartApp()| below won't actually be
79 // processed, and we'll just get a connection error. 79 // processed, and we'll just get a connection error.
80 child_process_host.ExitNow(123); 80 child_process_host.ExitNow(123);
81 mojo::MessagePipe mp; 81 mojo::MessagePipe mp;
82 mojo::InterfaceRequest<mojo::Application> application_request; 82 mojo::InterfaceRequest<mojo::Application> application_request;
83 application_request.Bind(mp.handle0.Pass()); 83 application_request.Bind(mp.handle0.Pass());
84 // This won't actually be called, but the callback should be run. 84 // This won't actually be called, but the callback should be run.
85 MojoResult result = MOJO_RESULT_INTERNAL; 85 MojoResult result = MOJO_RESULT_INTERNAL;
86 child_process_host.StartApp("/does_not_exist/cbvgyuio", 86 child_process_host.StartApp("/does_not_exist/cbvgyuio",
87 application_request.Pass(), [&result](int32_t r) { 87 application_request.Pass(), [&result](int32_t r) {
88 result = r; 88 result = r;
89 base::MessageLoop::current()->QuitWhenIdle(); 89 base::MessageLoop::current()->QuitWhenIdle();
90 }); 90 });
91 message_loop.Run(); 91 message_loop.Run();
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') | shell/out_of_process_native_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698