src/base/threading/hang_watcher_unittest.cc
// Test that execution blocks in ~HangWatchScope() for a thread under watch
// during the capturing of a hang.
Test that execution blocks in ~HangWatchScope() for a thread under watch
during the capturing of a hang.
Test that execution blocks in ~HangWatchScope () for a thread under watch during the capturing of a hang .
TEST_F(HangWatchScopeBlockingTest, ScopeBlocksDuringCapture) {
  {
    HangWatchScope already_over(base::TimeDelta::FromDays(-1));
    hang_watcher_->SignalMonitorEventForTesting();
    capture_started_.Wait();
  }
  EXPECT_TRUE(completed_capture_);
  completed_monitoring_.Reset();
  capture_started_.Reset();
  completed_capture_ = false;
  VerifyScopesDontBlock();
}
TEST_F ( HangWatchScopeBlockingTest , ScopeBlocksDuringCapture ) { { HangWatchScope already_over ( base :: TimeDelta :: FromDays ( -1 ) ) ; hang_watcher_ -> SignalMonitorEventForTesting ( ) ; capture_started_ . Wait ( ) ; } EXPECT_TRUE ( completed_capture_ ) ; completed_monitoring_ . Reset ( ) ; capture_started_ . Reset ( ) ; completed_capture_ = false ; VerifyScopesDontBlock ( ) ; }
Test that execution blocks in ~HangWatchScope() for a thread under watch
during the capturing of a hang.
Test that execution blocks in ~HangWatchScope () for a thread under watch during the capturing of a hang .
// Start a hang watch scope that expires in the past already. Ensures that the // first monitor will detect a hang. // Manually trigger a monitoring. // Ensure that the hang capturing started. // Execution will get stuck in this scope because execution does not escape // ~HangWatchScope() if a hang capture is under way. // A hang was in progress so execution should have been blocked in // BlockWhileCaptureInProgress() until capture finishes. // Reset expectations // Verify that scopes don't block just because a capture happened in the past.