Index: components/scheduler/renderer/throttling_helper_unittest.cc |
diff --git a/components/scheduler/renderer/throttling_helper_unittest.cc b/components/scheduler/renderer/throttling_helper_unittest.cc |
index 117e9a2baa0489dc506b2c563b69207870db5c20..99c52aaac9df16b02f8122a4e33d49a837cee774 100644 |
--- a/components/scheduler/renderer/throttling_helper_unittest.cc |
+++ b/components/scheduler/renderer/throttling_helper_unittest.cc |
@@ -330,34 +330,21 @@ TEST_F(ThrottlingHelperTest, |
base::TimeTicks() + base::TimeDelta::FromSeconds(16))); |
} |
-TEST_F(ThrottlingHelperTest, TaskDelayIsBasedOnRealTime) { |
- std::vector<base::TimeTicks> run_times; |
- |
- throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
+TEST_F(ThrottlingHelperTest, ThrottledTasksReportRealTimeToBlink) { |
+ clock_->Advance(base::TimeDelta::FromSeconds(1)); |
- // Post an initial task that should run at the first aligned time period. |
- timer_queue_->PostDelayedTask(FROM_HERE, |
- base::Bind(&TestTask, &run_times, clock_.get()), |
- base::TimeDelta::FromMilliseconds(900.0)); |
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->BlinkNow(), clock_->NowTicks()); |
- mock_task_runner_->RunUntilIdle(); |
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
+ // Note the throttled time domain's view of time is usally in the past. |
+ EXPECT_LT(timer_queue_->GetTimeDomain()->Now(), clock_->NowTicks()); |
+ // But we report the current real time to blink. |
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->BlinkNow(), clock_->NowTicks()); |
- // Advance realtime. |
+ // Advance realtime, and make sure BlinkNow advances too. |
clock_->Advance(base::TimeDelta::FromMilliseconds(250)); |
- |
- // Post a task that due to real time + delay must run in the third aligned |
- // time period. |
- timer_queue_->PostDelayedTask(FROM_HERE, |
- base::Bind(&TestTask, &run_times, clock_.get()), |
- base::TimeDelta::FromMilliseconds(900.0)); |
- |
- mock_task_runner_->RunUntilIdle(); |
- |
- EXPECT_THAT( |
- run_times, |
- ElementsAre( |
- base::TimeTicks() + base::TimeDelta::FromMilliseconds(1000.0), |
- base::TimeTicks() + base::TimeDelta::FromMilliseconds(3000.0))); |
+ EXPECT_LT(timer_queue_->GetTimeDomain()->Now(), clock_->NowTicks()); |
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->BlinkNow(), clock_->NowTicks()); |
} |
TEST_F(ThrottlingHelperTest, TaskQueueDisabledTillPump) { |