| 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 "components/browser_watcher/window_hang_monitor_win.h" | 5 #include "components/browser_watcher/window_hang_monitor_win.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 CreateMessageWindow(); | 361 CreateMessageWindow(); |
| 362 | 362 |
| 363 monitor_thread().Start(base::Process::Current(), window_name()); | 363 monitor_thread().Start(base::Process::Current(), window_name()); |
| 364 | 364 |
| 365 ASSERT_FALSE(monitor_thread().TimedWaitForEvent( | 365 ASSERT_FALSE(monitor_thread().TimedWaitForEvent( |
| 366 base::TimeDelta::FromMilliseconds(150))); | 366 base::TimeDelta::FromMilliseconds(150))); |
| 367 | 367 |
| 368 // Block the worker thread. | 368 // Block the worker thread. |
| 369 base::WaitableEvent hang(true, false); | 369 base::WaitableEvent hang(true, false); |
| 370 | 370 |
| 371 window_thread()->message_loop_proxy()->PostTask( | 371 window_thread()->task_runner()->PostTask( |
| 372 FROM_HERE, | 372 FROM_HERE, |
| 373 base::Bind(&base::WaitableEvent::Wait, base::Unretained(&hang))); | 373 base::Bind(&base::WaitableEvent::Wait, base::Unretained(&hang))); |
| 374 | 374 |
| 375 EXPECT_EQ(WindowHangMonitor::WINDOW_HUNG, | 375 EXPECT_EQ(WindowHangMonitor::WINDOW_HUNG, |
| 376 monitor_thread().WaitForEvent()); | 376 monitor_thread().WaitForEvent()); |
| 377 | 377 |
| 378 // Unblock the worker thread. | 378 // Unblock the worker thread. |
| 379 hang.Signal(); | 379 hang.Signal(); |
| 380 | 380 |
| 381 ASSERT_FALSE(monitor_thread().TimedWaitForEvent( | 381 ASSERT_FALSE(monitor_thread().TimedWaitForEvent( |
| 382 base::TimeDelta::FromMilliseconds(150))); | 382 base::TimeDelta::FromMilliseconds(150))); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace browser_watcher | 385 } // namespace browser_watcher |
| OLD | NEW |