| Index: cc/scheduler/vsync_time_source_unittest.cc
|
| diff --git a/cc/scheduler/vsync_time_source_unittest.cc b/cc/scheduler/vsync_time_source_unittest.cc
|
| index d652017a8cd113c99b35655ee420b0d3973dcb39..4834630e6a1592b1a86025c4b26ce104317b9704 100644
|
| --- a/cc/scheduler/vsync_time_source_unittest.cc
|
| +++ b/cc/scheduler/vsync_time_source_unittest.cc
|
| @@ -32,7 +32,9 @@ class FakeVSyncProvider : public VSyncProvider {
|
|
|
| class VSyncTimeSourceTest : public testing::Test {
|
| public:
|
| - VSyncTimeSourceTest() : timer_(VSyncTimeSource::Create(&provider_)) {
|
| + VSyncTimeSourceTest()
|
| + : timer_(VSyncTimeSource::Create(
|
| + &provider_, VSyncTimeSource::DISABLE_ON_NEXT_TICK)) {
|
| timer_->SetClient(&client_);
|
| }
|
|
|
| @@ -80,6 +82,30 @@ TEST_F(VSyncTimeSourceTest, NotificationDisabledLazily) {
|
| EXPECT_FALSE(client_.TickCalled());
|
| }
|
|
|
| +TEST_F(VSyncTimeSourceTest, NotificationDisabledImmediatelyForSetting) {
|
| + timer_ = VSyncTimeSource::Create(&provider_,
|
| + VSyncTimeSource::DISABLE_SYNCHRONOUSLY);
|
| + timer_->SetClient(&client_);
|
| + base::TimeTicks frame_time = base::TimeTicks::Now();
|
| +
|
| + // Enable timer and trigger sync once.
|
| + timer_->SetActive(true);
|
| + EXPECT_TRUE(provider_.IsVSyncNotificationEnabled());
|
| + provider_.Trigger(frame_time);
|
| + EXPECT_TRUE(client_.TickCalled());
|
| +
|
| + // Disable timer should disable vsync notification immediately.
|
| + timer_->SetActive(false);
|
| + EXPECT_FALSE(provider_.IsVSyncNotificationEnabled());
|
| +
|
| + // Enable again and timer can be ticked again.
|
| + client_.Reset();
|
| + timer_->SetActive(true);
|
| + EXPECT_TRUE(provider_.IsVSyncNotificationEnabled());
|
| + provider_.Trigger(frame_time);
|
| + EXPECT_TRUE(client_.TickCalled());
|
| +}
|
| +
|
| TEST_F(VSyncTimeSourceTest, ValidNextTickTime) {
|
| base::TimeTicks frame_time = base::TimeTicks::Now();
|
| base::TimeDelta interval = base::TimeDelta::FromSeconds(1);
|
|
|