OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 continue_event_name_ = | 184 continue_event_name_ = |
185 base::StringPrintf(L"continue-event-%d", base::GetCurrentProcId()); | 185 base::StringPrintf(L"continue-event-%d", base::GetCurrentProcId()); |
186 continue_event_.Set( | 186 continue_event_.Set( |
187 ::CreateEvent(NULL, TRUE, FALSE, continue_event_name_.c_str())); | 187 ::CreateEvent(NULL, TRUE, FALSE, continue_event_name_.c_str())); |
188 ASSERT_TRUE(continue_event_.IsValid()); | 188 ASSERT_TRUE(continue_event_.IsValid()); |
189 | 189 |
190 window_option_ = window_option; | 190 window_option_ = window_option; |
191 | 191 |
192 base::LaunchOptions options; | 192 base::LaunchOptions options; |
193 options.start_hidden = true; | 193 options.start_hidden = true; |
194 browser_victim_ = | 194 base::SpawnChildResult spawn_result = |
195 SpawnChildWithOptions("ProcessSingletonTestProcessMain", options); | 195 SpawnChildWithOptions("ProcessSingletonTestProcessMain", options); |
| 196 browser_victim_ = std::move(spawn_result.process); |
196 | 197 |
197 // Wait for the ready event (or process exit). | 198 // Wait for the ready event (or process exit). |
198 HANDLE handles[] = {ready_event.Get(), browser_victim_.Handle()}; | 199 HANDLE handles[] = {ready_event.Get(), browser_victim_.Handle()}; |
199 // The wait should always return because either |ready_event| is signaled or | 200 // The wait should always return because either |ready_event| is signaled or |
200 // |browser_victim_| died unexpectedly or exited on error. | 201 // |browser_victim_| died unexpectedly or exited on error. |
201 DWORD result = | 202 DWORD result = |
202 ::WaitForMultipleObjects(arraysize(handles), handles, FALSE, INFINITE); | 203 ::WaitForMultipleObjects(arraysize(handles), handles, FALSE, INFINITE); |
203 ASSERT_EQ(WAIT_OBJECT_0, result); | 204 ASSERT_EQ(WAIT_OBJECT_0, result); |
204 } | 205 } |
205 | 206 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // visible window. | 319 // visible window. |
319 EXPECT_TRUE(should_kill_called()); | 320 EXPECT_TRUE(should_kill_called()); |
320 | 321 |
321 // Verify that the hung browser has been terminated with the | 322 // Verify that the hung browser has been terminated with the |
322 // RESULT_CODE_HUNG exit code. | 323 // RESULT_CODE_HUNG exit code. |
323 int exit_code = 0; | 324 int exit_code = 0; |
324 EXPECT_TRUE( | 325 EXPECT_TRUE( |
325 browser_victim()->WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); | 326 browser_victim()->WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); |
326 EXPECT_EQ(content::RESULT_CODE_HUNG, exit_code); | 327 EXPECT_EQ(content::RESULT_CODE_HUNG, exit_code); |
327 } | 328 } |
OLD | NEW |