| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 ScopedMessagePipeHandle StartChildWithExtraSwitch( | 59 ScopedMessagePipeHandle StartChildWithExtraSwitch( |
| 60 const std::string& test_child_name, | 60 const std::string& test_child_name, |
| 61 const std::string& switch_string, | 61 const std::string& switch_string, |
| 62 const std::string& switch_value, | 62 const std::string& switch_value, |
| 63 LaunchType launch_type); | 63 LaunchType launch_type); |
| 64 | 64 |
| 65 void set_process_error_callback(const ProcessErrorCallback& callback) { | 65 void set_process_error_callback(const ProcessErrorCallback& callback) { |
| 66 process_error_callback_ = callback; | 66 process_error_callback_ = callback; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ClosePeerConnection(); |
| 70 |
| 69 // Wait for the child process to terminate. | 71 // Wait for the child process to terminate. |
| 70 // Returns the exit code of the child process. Note that, though it's declared | 72 // Returns the exit code of the child process. Note that, though it's declared |
| 71 // to be an |int|, the exit code is subject to mangling by the OS. E.g., we | 73 // to be an |int|, the exit code is subject to mangling by the OS. E.g., we |
| 72 // usually return -1 on error in the child (e.g., if |test_child_name| was not | 74 // usually return -1 on error in the child (e.g., if |test_child_name| was not |
| 73 // found), but this is mangled to 255 on Linux. You should only rely on codes | 75 // found), but this is mangled to 255 on Linux. You should only rely on codes |
| 74 // 0-127 being preserved, and -1 being outside the range 0-127. | 76 // 0-127 being preserved, and -1 being outside the range 0-127. |
| 75 int WaitForChildShutdown(); | 77 int WaitForChildShutdown(); |
| 76 | 78 |
| 77 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) | 79 // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0) |
| 78 // and false otherwise. You probably want to do something like | 80 // and false otherwise. You probably want to do something like |
| (...skipping 10 matching lines...) Expand all Loading... |
| 89 | 91 |
| 90 // For use (and only valid) in the child process: | 92 // For use (and only valid) in the child process: |
| 91 static mojo::ScopedMessagePipeHandle primordial_pipe; | 93 static mojo::ScopedMessagePipeHandle primordial_pipe; |
| 92 | 94 |
| 93 private: | 95 private: |
| 94 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 96 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
| 95 base::Process test_child_; | 97 base::Process test_child_; |
| 96 | 98 |
| 97 ProcessErrorCallback process_error_callback_; | 99 ProcessErrorCallback process_error_callback_; |
| 98 | 100 |
| 101 std::string peer_token_; |
| 102 |
| 99 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 103 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
| 100 }; | 104 }; |
| 101 | 105 |
| 102 } // namespace test | 106 } // namespace test |
| 103 } // namespace edk | 107 } // namespace edk |
| 104 } // namespace mojo | 108 } // namespace mojo |
| 105 | 109 |
| 106 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 110 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
| OLD | NEW |