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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/process/process.h" | 11 #include "base/process/process.h" |
11 #include "base/test/multiprocess_test.h" | 12 #include "base/test/multiprocess_test.h" |
12 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
13 #include "mojo/edk/embedder/scoped_platform_handle.h" | 14 #include "mojo/edk/embedder/scoped_platform_handle.h" |
14 #include "mojo/public/cpp/system/macros.h" | 15 #include "mojo/public/cpp/system/macros.h" |
15 #include "testing/multiprocess_func_list.h" | 16 #include "testing/multiprocess_func_list.h" |
16 | 17 |
17 namespace mojo { | 18 namespace mojo { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // For use by |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| only: | 55 // For use by |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| only: |
55 static void ChildSetup(); | 56 static void ChildSetup(); |
56 | 57 |
57 // For use in the main process: | 58 // For use in the main process: |
58 embedder::ScopedPlatformHandle server_platform_handle; | 59 embedder::ScopedPlatformHandle server_platform_handle; |
59 | 60 |
60 // For use (and only valid) in the child process: | 61 // For use (and only valid) in the child process: |
61 static embedder::ScopedPlatformHandle client_platform_handle; | 62 static embedder::ScopedPlatformHandle client_platform_handle; |
62 | 63 |
63 private: | 64 private: |
64 scoped_ptr<embedder::PlatformChannelPair> platform_channel_pair_; | 65 std::unique_ptr<embedder::PlatformChannelPair> platform_channel_pair_; |
65 | 66 |
66 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 67 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
67 base::Process test_child_; | 68 base::Process test_child_; |
68 | 69 |
69 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 70 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
70 }; | 71 }; |
71 | 72 |
72 // Use this to declare the child process's "main()" function for tests using | 73 // Use this to declare the child process's "main()" function for tests using |
73 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's | 74 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's |
74 // exit code (but see the comment about |WaitForChildShutdown()|). | 75 // exit code (but see the comment about |WaitForChildShutdown()|). |
(...skipping 14 matching lines...) Expand all Loading... |
89 ::testing::Test::HasNonfatalFailure()) \ | 90 ::testing::Test::HasNonfatalFailure()) \ |
90 ? 1 \ | 91 ? 1 \ |
91 : 0; \ | 92 : 0; \ |
92 } \ | 93 } \ |
93 void test_child_name##TestChildTest() | 94 void test_child_name##TestChildTest() |
94 | 95 |
95 } // namespace test | 96 } // namespace test |
96 } // namespace mojo | 97 } // namespace mojo |
97 | 98 |
98 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 99 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
OLD | NEW |