Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2993)

Unified Diff: components/scheduler/renderer/throttling_helper_unittest.cc

Issue 2155143002: Fix a bug that could occasionaly cause setInterval to stop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed ThrottledTimeDomain to be based on RealTimeDomain Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..cae2b7f9ca0dea078c17074df4a8081e4f8cbfdc 100644
--- a/components/scheduler/renderer/throttling_helper_unittest.cc
+++ b/components/scheduler/renderer/throttling_helper_unittest.cc
@@ -360,6 +360,18 @@ TEST_F(ThrottlingHelperTest, TaskDelayIsBasedOnRealTime) {
base::TimeTicks() + base::TimeDelta::FromMilliseconds(3000.0)));
}
+TEST_F(ThrottlingHelperTest, ThrottledTasksReportRealTime) {
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->Now(), clock_->NowTicks());
+
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get());
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->Now(), clock_->NowTicks());
+
+ clock_->Advance(base::TimeDelta::FromMilliseconds(250));
+ // Make sure the throttled time domain's Now() reports the same as the
+ // underlying clock.
+ EXPECT_EQ(timer_queue_->GetTimeDomain()->Now(), clock_->NowTicks());
+}
+
TEST_F(ThrottlingHelperTest, TaskQueueDisabledTillPump) {
timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask));

Powered by Google App Engine
This is Rietveld 408576698