OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
6 #include <winternl.h> | 6 #include <winternl.h> |
7 | 7 |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #define MAYBE_MultiProcess MultiProcess | 107 #define MAYBE_MultiProcess MultiProcess |
108 #endif | 108 #endif |
109 | 109 |
110 TEST(ScopedHandleTest, MAYBE_MultiProcess) { | 110 TEST(ScopedHandleTest, MAYBE_MultiProcess) { |
111 // Initializing ICU in the child process causes a scoped handle to be created | 111 // Initializing ICU in the child process causes a scoped handle to be created |
112 // before the test gets a chance to test the race condition, so disable ICU | 112 // before the test gets a chance to test the race condition, so disable ICU |
113 // for the child process here. | 113 // for the child process here. |
114 CommandLine command_line(base::GetMultiProcessTestChildBaseCommandLine()); | 114 CommandLine command_line(base::GetMultiProcessTestChildBaseCommandLine()); |
115 command_line.AppendSwitch(switches::kTestDoNotInitializeIcu); | 115 command_line.AppendSwitch(switches::kTestDoNotInitializeIcu); |
116 | 116 |
117 base::Process test_child_process = base::SpawnMultiProcessTestChild( | 117 base::SpawnChildResult spawn_child = base::SpawnMultiProcessTestChild( |
118 "ActiveVerifierChildProcess", command_line, LaunchOptions()); | 118 "ActiveVerifierChildProcess", command_line, LaunchOptions()); |
119 | 119 |
120 int rv = -1; | 120 int rv = -1; |
121 ASSERT_TRUE(test_child_process.WaitForExitWithTimeout( | 121 ASSERT_TRUE(spawn_child.process.WaitForExitWithTimeout( |
122 TestTimeouts::action_timeout(), &rv)); | 122 TestTimeouts::action_timeout(), &rv)); |
123 EXPECT_EQ(0, rv); | 123 EXPECT_EQ(0, rv); |
124 } | 124 } |
125 | 125 |
126 MULTIPROCESS_TEST_MAIN(ActiveVerifierChildProcess) { | 126 MULTIPROCESS_TEST_MAIN(ActiveVerifierChildProcess) { |
127 ScopedNativeLibrary module(FilePath(L"scoped_handle_test_dll.dll")); | 127 ScopedNativeLibrary module(FilePath(L"scoped_handle_test_dll.dll")); |
128 | 128 |
129 if (!module.is_valid()) | 129 if (!module.is_valid()) |
130 return 1; | 130 return 1; |
131 auto run_test_function = reinterpret_cast<decltype(&testing::RunTest)>( | 131 auto run_test_function = reinterpret_cast<decltype(&testing::RunTest)>( |
132 module.GetFunctionPointer("RunTest")); | 132 module.GetFunctionPointer("RunTest")); |
133 if (!run_test_function) | 133 if (!run_test_function) |
134 return 1; | 134 return 1; |
135 if (!run_test_function()) | 135 if (!run_test_function()) |
136 return 1; | 136 return 1; |
137 | 137 |
138 return 0; | 138 return 0; |
139 } | 139 } |
140 | 140 |
141 } // namespace win | 141 } // namespace win |
142 } // namespace base | 142 } // namespace base |
OLD | NEW |