| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/process/process_handle.h" | 11 #include "base/process/process.h" |
| 12 #include "base/test/multiprocess_test.h" | 12 #include "base/test/multiprocess_test.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "mojo/edk/embedder/scoped_platform_handle.h" | 14 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 15 #include "testing/multiprocess_func_list.h" | 15 #include "testing/multiprocess_func_list.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 | 18 |
| 19 namespace embedder { | 19 namespace embedder { |
| 20 class PlatformChannelPair; | 20 class PlatformChannelPair; |
| 21 } | 21 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 // For use in the main process: | 51 // For use in the main process: |
| 52 embedder::ScopedPlatformHandle server_platform_handle; | 52 embedder::ScopedPlatformHandle server_platform_handle; |
| 53 | 53 |
| 54 // For use (and only valid) in the child process: | 54 // For use (and only valid) in the child process: |
| 55 static embedder::ScopedPlatformHandle client_platform_handle; | 55 static embedder::ScopedPlatformHandle client_platform_handle; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 scoped_ptr<embedder::PlatformChannelPair> platform_channel_pair_; | 58 scoped_ptr<embedder::PlatformChannelPair> platform_channel_pair_; |
| 59 | 59 |
| 60 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 60 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
| 61 base::ProcessHandle test_child_handle_; | 61 base::Process test_child_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 63 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Use this to declare the child process's "main()" function for tests using | 66 // Use this to declare the child process's "main()" function for tests using |
| 67 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's | 67 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's |
| 68 // exit code (but see the comment about |WaitForChildShutdown()|). | 68 // exit code (but see the comment about |WaitForChildShutdown()|). |
| 69 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ | 69 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ |
| 70 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ | 70 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ |
| 71 test_child_name##TestChildMain, \ | 71 test_child_name##TestChildMain, \ |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 ::testing::Test::HasNonfatalFailure()) \ | 83 ::testing::Test::HasNonfatalFailure()) \ |
| 84 ? 1 \ | 84 ? 1 \ |
| 85 : 0; \ | 85 : 0; \ |
| 86 } \ | 86 } \ |
| 87 void test_child_name##TestChildTest() | 87 void test_child_name##TestChildTest() |
| 88 | 88 |
| 89 } // namespace test | 89 } // namespace test |
| 90 } // namespace mojo | 90 } // namespace mojo |
| 91 | 91 |
| 92 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 92 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
| OLD | NEW |