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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // usually return -1 on error in the child (e.g., if |test_child_name| was not | 48 // usually return -1 on error in the child (e.g., if |test_child_name| was not |
49 // found), but this is mangled to 255 on Linux. You should only rely on codes | 49 // found), but this is mangled to 255 on Linux. You should only rely on codes |
50 // 0-127 being preserved, and -1 being outside the range 0-127. | 50 // 0-127 being preserved, and -1 being outside the range 0-127. |
51 int WaitForChildShutdown(); | 51 int WaitForChildShutdown(); |
52 | 52 |
53 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) | 53 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) |
54 // and false otherwise. You probably want to do something like | 54 // and false otherwise. You probably want to do something like |
55 // |EXPECT_TRUE(WaitForChildTestShutdown());|. | 55 // |EXPECT_TRUE(WaitForChildTestShutdown());|. |
56 bool WaitForChildTestShutdown(); | 56 bool WaitForChildTestShutdown(); |
57 | 57 |
| 58 const base::Process& test_child() const { return test_child_; } |
| 59 |
58 // Used by macros in mojo/edk/test/mojo_test_base.h to support multiprocess | 60 // Used by macros in mojo/edk/test/mojo_test_base.h to support multiprocess |
59 // test client initialization. | 61 // test client initialization. |
60 static void ChildSetup(); | 62 static void ChildSetup(); |
61 static int RunClientMain(const base::Callback<int(MojoHandle)>& main); | 63 static int RunClientMain(const base::Callback<int(MojoHandle)>& main); |
62 static int RunClientTestMain(const base::Callback<void(MojoHandle)>& main); | 64 static int RunClientTestMain(const base::Callback<void(MojoHandle)>& main); |
63 | 65 |
64 // For use (and only valid) in the child process: | 66 // For use (and only valid) in the child process: |
65 static std::string primordial_pipe_token; | 67 static std::string primordial_pipe_token; |
66 | 68 |
67 private: | 69 private: |
68 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 70 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
69 base::Process test_child_; | 71 base::Process test_child_; |
70 | 72 |
71 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 73 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace test | 76 } // namespace test |
75 } // namespace edk | 77 } // namespace edk |
76 } // namespace mojo | 78 } // namespace mojo |
77 | 79 |
78 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 80 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
OLD | NEW |