OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 5 #ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) | 78 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) |
79 // and false otherwise. You probably want to do something like | 79 // and false otherwise. You probably want to do something like |
80 // |EXPECT_TRUE(WaitForChildTestShutdown());|. | 80 // |EXPECT_TRUE(WaitForChildTestShutdown());|. |
81 bool WaitForChildTestShutdown(); | 81 bool WaitForChildTestShutdown(); |
82 | 82 |
83 const base::Process& test_child() const { return test_child_.process; } | 83 const base::Process& test_child() const { return test_child_.process; } |
84 | 84 |
85 // Used by macros in mojo/edk/test/mojo_test_base.h to support multiprocess | 85 // Used by macros in mojo/edk/test/mojo_test_base.h to support multiprocess |
86 // test client initialization. | 86 // test client initialization. |
87 static void ChildSetup(); | 87 static void ChildSetup(); |
88 static int RunClientMain(const base::Callback<int(MojoHandle)>& main); | 88 static int RunClientMain(const base::Callback<int(MojoHandle)>& main, |
| 89 bool pass_pipe_ownership_to_main = false); |
89 static int RunClientTestMain(const base::Callback<void(MojoHandle)>& main); | 90 static int RunClientTestMain(const base::Callback<void(MojoHandle)>& main); |
90 | 91 |
91 // For use (and only valid) in the child process: | 92 // For use (and only valid) in the child process: |
92 static mojo::ScopedMessagePipeHandle primordial_pipe; | 93 static mojo::ScopedMessagePipeHandle primordial_pipe; |
93 | 94 |
94 private: | 95 private: |
95 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 96 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
96 base::SpawnChildResult test_child_; | 97 base::SpawnChildResult test_child_; |
97 | 98 |
98 ProcessErrorCallback process_error_callback_; | 99 ProcessErrorCallback process_error_callback_; |
99 | 100 |
100 std::string peer_token_; | 101 std::string peer_token_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 103 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace test | 106 } // namespace test |
106 } // namespace edk | 107 } // namespace edk |
107 } // namespace mojo | 108 } // namespace mojo |
108 | 109 |
109 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 110 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
OLD | NEW |