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

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

Issue 1958283005: Throttling Helper to disable task queue until PumpThrottledTasks called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 7 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
« no previous file with comments | « components/scheduler/renderer/throttling_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1e95a0bf4427aae4c839bc468bd56c89710634f3..4234d170189c47897ba05c56befcc9197e7c9064 100644
--- a/components/scheduler/renderer/throttling_helper_unittest.cc
+++ b/components/scheduler/renderer/throttling_helper_unittest.cc
@@ -360,4 +360,25 @@ TEST_F(ThrottlingHelperTest, TaskDelayIsBasedOnRealTime) {
base::TimeTicks() + base::TimeDelta::FromMilliseconds(3000.0)));
}
+TEST_F(ThrottlingHelperTest, TaskQueueDisabledTillPump) {
+ timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask));
+
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled());
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get());
+ EXPECT_FALSE(timer_queue_->IsQueueEnabled());
+
+ mock_task_runner_->RunUntilIdle(); // Wait until the pump.
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled());
+}
+
+TEST_F(ThrottlingHelperTest, TaskQueueEnabledOnUnthrottle) {
+ timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask));
+
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get());
+ EXPECT_FALSE(timer_queue_->IsQueueEnabled());
+
+ throttling_helper_->DecreaseThrottleRefCount(timer_queue_.get());
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled());
+}
+
} // namespace scheduler
« no previous file with comments | « components/scheduler/renderer/throttling_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698