chrome/browser/chromeos/power/session_length_limiter_unittest.cc
// Creates a SessionLengthLimiter after setting a 60 second limit, allows 50
// seconds of session time to pass, then removes the limit. Verifies that after
// the limit is removed, the session is not terminated when the session time
// reaches the original 60 second limit.
Creates a SessionLengthLimiter after setting a 60 second limit, allows 50
seconds of session time to pass, then removes the limit. Verifies that after
the limit is removed, the session is not terminated when the session time
reaches the original 60 second limit.
Creates a SessionLengthLimiter after setting a 60 second limit allows 50 seconds of session time to pass then removes the limit . Verifies that after the limit is removed the session is not terminated when the session time reaches the original 60 second limit .
TEST_F(SessionLengthLimiterTest, RunAndRemoveSessionLengthLimit) {
  base::ThreadTaskRunnerHandle runner_handler(runner_);
  SetSessionLengthLimitPref(60 * 1000);  
  CreateSessionLengthLimiter(false);
  while (*remaining_ > kTenSeconds)
    VerifyTimerTick();
  local_state_.RemoveUserPref(prefs::kSessionLengthLimit);
  while (*remaining_ > kZeroTimeDelta) {
    runner_->RunTasks();
    now_ += kSessionLengthLimitTimerInterval;
    *remaining_ -= kSessionLengthLimitTimerInterval;
    if (*remaining_ < kZeroTimeDelta)
      remaining_.reset(new base::TimeDelta(kZeroTimeDelta));
  }
  now_ += kSessionLengthLimitTimerInterval;
  runner_->RunTasks();
}
TEST_F ( SessionLengthLimiterTest , RunAndRemoveSessionLengthLimit ) { base :: ThreadTaskRunnerHandle runner_handler ( runner_ ) ; SetSessionLengthLimitPref ( 60 * 1000 ) ; CreateSessionLengthLimiter ( false ) ; while ( * remaining_ > kTenSeconds ) VerifyTimerTick ( ) ; local_state_ . RemoveUserPref ( prefs :: kSessionLengthLimit ) ; while ( * remaining_ > kZeroTimeDelta ) { runner_ -> RunTasks ( ) ; now_ += kSessionLengthLimitTimerInterval ; * remaining_ -= kSessionLengthLimitTimerInterval ; if ( * remaining_ < kZeroTimeDelta ) remaining_ . reset ( new base :: TimeDelta ( kZeroTimeDelta ) ) ; } now_ += kSessionLengthLimitTimerInterval ; runner_ -> RunTasks ( ) ; }
Creates a SessionLengthLimiter after setting a 60 second limit, allows 50
seconds of session time to pass, then removes the limit.
Creates a SessionLengthLimiter after setting a 60 second limit allows 50 seconds of session time to pass then removes the limit .
// Set a 60 second session time limit. // 60 seconds. // Create a SessionLengthLimiter. // Check timer ticks for 50 seconds of session time. // Remove the session length limit. // Continue advancing the session time until it reaches the original 60 second // limit. // Check that the next timer tick does not lead to the session being // terminated.