| 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 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 child_process_host.Start(); | 76 child_process_host.Start(); |
| 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", false, | 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 |
| OLD | NEW |