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 cae2b7f9ca0dea078c17074df4a8081e4f8cbfdc..5a76b1de762baec9716d8bad1560be121788a268 100644 |
--- a/components/scheduler/renderer/throttling_helper_unittest.cc |
+++ b/components/scheduler/renderer/throttling_helper_unittest.cc |
@@ -15,6 +15,7 @@ |
#include "cc/test/ordered_simple_task_runner.h" |
#include "components/scheduler/base/test_time_source.h" |
#include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" |
+#include "components/scheduler/renderer/auto_advancing_virtual_time_domain.h" |
#include "components/scheduler/renderer/renderer_scheduler_impl.h" |
#include "components/scheduler/renderer/web_frame_scheduler_impl.h" |
#include "components/scheduler/renderer/web_view_scheduler_impl.h" |
@@ -452,4 +453,28 @@ TEST_F(ThrottlingHelperTest, DoubleIncrementDoubleDecrement) { |
EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
} |
+TEST_F(ThrottlingHelperTest, EnableVirtualTimeThenIncrement) { |
+ timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask)); |
+ |
+ scheduler_->EnableVirtualTime(); |
+ EXPECT_EQ(timer_queue_->GetTimeDomain(), scheduler_->virtual_time_domain()); |
+ |
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
+ EXPECT_EQ(timer_queue_->GetTimeDomain(), scheduler_->virtual_time_domain()); |
+} |
+ |
+TEST_F(ThrottlingHelperTest, IncrementThenEnableVirtualTime) { |
+ timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask)); |
+ |
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
+ throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
+ EXPECT_FALSE(timer_queue_->IsQueueEnabled()); |
+ |
+ scheduler_->EnableVirtualTime(); |
+ EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
+ EXPECT_EQ(timer_queue_->GetTimeDomain(), scheduler_->virtual_time_domain()); |
+} |
+ |
} // namespace scheduler |