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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 protected: | 147 protected: |
148 enum WindowOption { WITH_WINDOW, NO_WINDOW }; | 148 enum WindowOption { WITH_WINDOW, NO_WINDOW }; |
149 | 149 |
150 ProcessSingletonTest() | 150 ProcessSingletonTest() |
151 : window_option_(NO_WINDOW), should_kill_called_(false) {} | 151 : window_option_(NO_WINDOW), should_kill_called_(false) {} |
152 | 152 |
153 void SetUp() override { | 153 void SetUp() override { |
154 ASSERT_NO_FATAL_FAILURE(base::MultiProcessTest::SetUp()); | 154 ASSERT_NO_FATAL_FAILURE(base::MultiProcessTest::SetUp()); |
155 | 155 |
156 // Drop the process finder notification timeout to one second for testing. | 156 // Drop the process finder notification timeout to one second for testing. |
157 old_notification_timeout_ = chrome::SetNotificationTimeoutForTesting( | 157 old_notification_timeout_ = chrome::win::SetNotificationTimeoutForTesting( |
158 base::TimeDelta::FromSeconds(1)); | 158 base::TimeDelta::FromSeconds(1)); |
159 } | 159 } |
160 | 160 |
161 void TearDown() override { | 161 void TearDown() override { |
162 chrome::SetNotificationTimeoutForTesting(old_notification_timeout_); | 162 chrome::win::SetNotificationTimeoutForTesting(old_notification_timeout_); |
163 | 163 |
164 if (browser_victim_.IsValid()) { | 164 if (browser_victim_.IsValid()) { |
165 EXPECT_TRUE(::SetEvent(continue_event_.Get())); | 165 EXPECT_TRUE(::SetEvent(continue_event_.Get())); |
166 EXPECT_TRUE(browser_victim_.WaitForExit(nullptr)); | 166 EXPECT_TRUE(browser_victim_.WaitForExit(nullptr)); |
167 } | 167 } |
168 | 168 |
169 base::MultiProcessTest::TearDown(); | 169 base::MultiProcessTest::TearDown(); |
170 } | 170 } |
171 | 171 |
172 void LaunchHungBrowserProcess(WindowOption window_option) { | 172 void LaunchHungBrowserProcess(WindowOption window_option) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // visible window. | 310 // visible window. |
311 EXPECT_TRUE(should_kill_called()); | 311 EXPECT_TRUE(should_kill_called()); |
312 | 312 |
313 // Verify that the hung browser has beem terminated with the | 313 // Verify that the hung browser has beem terminated with the |
314 // RESULT_CODE_HUNG exit code. | 314 // RESULT_CODE_HUNG exit code. |
315 int exit_code = 0; | 315 int exit_code = 0; |
316 EXPECT_TRUE( | 316 EXPECT_TRUE( |
317 browser_victim()->WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); | 317 browser_victim()->WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); |
318 EXPECT_EQ(content::RESULT_CODE_HUNG, exit_code); | 318 EXPECT_EQ(content::RESULT_CODE_HUNG, exit_code); |
319 } | 319 } |
OLD | NEW |