| 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/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Valid after |StartChild()| and before |WaitForChildShutdown()|. | 61 // Valid after |StartChild()| and before |WaitForChildShutdown()|. |
| 62 base::ProcessHandle test_child_handle_; | 62 base::ProcessHandle test_child_handle_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); | 64 DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 // Use this to declare the child process's "main()" function for tests using | 67 // Use this to declare the child process's "main()" function for tests using |
| 68 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's | 68 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's |
| 69 // exit code (but see the comment about |WaitForChildShutdown()|). | 69 // exit code (but see the comment about |WaitForChildShutdown()|). |
| 70 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ | 70 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ |
| 71 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ | 71 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ |
| 72 test_child_name ## TestChildMain, \ | 72 test_child_name##TestChildMain, \ |
| 73 ::mojo::test::MultiprocessTestHelper::ChildSetup) | 73 ::mojo::test::MultiprocessTestHelper::ChildSetup) |
| 74 | 74 |
| 75 // Use this (and |WaitForChildTestShutdown()|) for the child process's "main()", | 75 // Use this (and |WaitForChildTestShutdown()|) for the child process's "main()", |
| 76 // if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return | 76 // if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return |
| 77 // type. (Note that while an |ASSERT_...()| failure will abort the test in the | 77 // type. (Note that while an |ASSERT_...()| failure will abort the test in the |
| 78 // child, it will not abort the test in the parent.) | 78 // child, it will not abort the test in the parent.) |
| 79 #define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \ | 79 #define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \ |
| 80 void test_child_name ## TestChildTest(); \ | 80 void test_child_name##TestChildTest(); \ |
| 81 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \ | 81 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \ |
| 82 test_child_name ## TestChildTest(); \ | 82 test_child_name##TestChildTest(); \ |
| 83 return (::testing::Test::HasFatalFailure() || \ | 83 return (::testing::Test::HasFatalFailure() || \ |
| 84 ::testing::Test::HasNonfatalFailure()) ? 1 : 0; \ | 84 ::testing::Test::HasNonfatalFailure()) \ |
| 85 } \ | 85 ? 1 \ |
| 86 void test_child_name ## TestChildTest() | 86 : 0; \ |
| 87 } \ |
| 88 void test_child_name##TestChildTest() |
| 87 | 89 |
| 88 } // namespace test | 90 } // namespace test |
| 89 } // namespace mojo | 91 } // namespace mojo |
| 90 | 92 |
| 91 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ | 93 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ |
| OLD | NEW |