| 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 #include "mojo/edk/test/multiprocess_test_helper.h" | 5 #include "mojo/edk/test/multiprocess_test_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "mojo/edk/embedder/scoped_platform_handle.h" | 9 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 10 #include "mojo/edk/test/test_utils.h" | 10 #include "mojo/edk/test/test_utils.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 TEST_F(MultiprocessTestHelperTest, ChildTestPasses) { | 112 TEST_F(MultiprocessTestHelperTest, ChildTestPasses) { |
| 113 MultiprocessTestHelper helper; | 113 MultiprocessTestHelper helper; |
| 114 EXPECT_TRUE(helper.server_platform_handle.is_valid()); | 114 EXPECT_TRUE(helper.server_platform_handle.is_valid()); |
| 115 helper.StartChild("ChildTestPasses"); | 115 helper.StartChild("ChildTestPasses"); |
| 116 EXPECT_TRUE(helper.WaitForChildTestShutdown()); | 116 EXPECT_TRUE(helper.WaitForChildTestShutdown()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestPasses) { | 119 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestPasses) { |
| 120 ASSERT_TRUE(MultiprocessTestHelper::client_platform_handle.is_valid()); | 120 ASSERT_TRUE(MultiprocessTestHelper::client_platform_handle.is_valid()); |
| 121 EXPECT_TRUE(IsNonBlocking( | 121 EXPECT_TRUE( |
| 122 MultiprocessTestHelper::client_platform_handle.get())); | 122 IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 TEST_F(MultiprocessTestHelperTest, ChildTestFailsAssert) { | 125 TEST_F(MultiprocessTestHelperTest, ChildTestFailsAssert) { |
| 126 MultiprocessTestHelper helper; | 126 MultiprocessTestHelper helper; |
| 127 EXPECT_TRUE(helper.server_platform_handle.is_valid()); | 127 EXPECT_TRUE(helper.server_platform_handle.is_valid()); |
| 128 helper.StartChild("ChildTestFailsAssert"); | 128 helper.StartChild("ChildTestFailsAssert"); |
| 129 EXPECT_FALSE(helper.WaitForChildTestShutdown()); | 129 EXPECT_FALSE(helper.WaitForChildTestShutdown()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsAssert) { | 132 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsAssert) { |
| 133 ASSERT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) | 133 ASSERT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) |
| 134 << "DISREGARD: Expected failure in child process"; | 134 << "DISREGARD: Expected failure in child process"; |
| 135 ASSERT_FALSE(IsNonBlocking( | 135 ASSERT_FALSE( |
| 136 MultiprocessTestHelper::client_platform_handle.get())) << "Not reached"; | 136 IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())) |
| 137 << "Not reached"; |
| 137 CHECK(false) << "Not reached"; | 138 CHECK(false) << "Not reached"; |
| 138 } | 139 } |
| 139 | 140 |
| 140 TEST_F(MultiprocessTestHelperTest, ChildTestFailsExpect) { | 141 TEST_F(MultiprocessTestHelperTest, ChildTestFailsExpect) { |
| 141 MultiprocessTestHelper helper; | 142 MultiprocessTestHelper helper; |
| 142 EXPECT_TRUE(helper.server_platform_handle.is_valid()); | 143 EXPECT_TRUE(helper.server_platform_handle.is_valid()); |
| 143 helper.StartChild("ChildTestFailsExpect"); | 144 helper.StartChild("ChildTestFailsExpect"); |
| 144 EXPECT_FALSE(helper.WaitForChildTestShutdown()); | 145 EXPECT_FALSE(helper.WaitForChildTestShutdown()); |
| 145 } | 146 } |
| 146 | 147 |
| 147 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsExpect) { | 148 MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsExpect) { |
| 148 EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) | 149 EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) |
| 149 << "DISREGARD: Expected failure #1 in child process"; | 150 << "DISREGARD: Expected failure #1 in child process"; |
| 150 EXPECT_FALSE(IsNonBlocking( | 151 EXPECT_FALSE( |
| 151 MultiprocessTestHelper::client_platform_handle.get())) | 152 IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())) |
| 152 << "DISREGARD: Expected failure #2 in child process"; | 153 << "DISREGARD: Expected failure #2 in child process"; |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace | 156 } // namespace |
| 156 } // namespace test | 157 } // namespace test |
| 157 } // namespace mojo | 158 } // namespace mojo |
| OLD | NEW |