| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/scheduler/vsync_time_source.h" | 5 #include "cc/scheduler/vsync_time_source.h" |
| 6 | 6 |
| 7 #include "cc/test/scheduler_test_common.h" | 7 #include "cc/test/scheduler_test_common.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 if (client_) | 25 if (client_) |
| 26 client_->DidVSync(frame_time); | 26 client_->DidVSync(frame_time); |
| 27 } | 27 } |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 VSyncClient* client_; | 30 VSyncClient* client_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class VSyncTimeSourceTest : public testing::Test { | 33 class VSyncTimeSourceTest : public testing::Test { |
| 34 public: | 34 public: |
| 35 VSyncTimeSourceTest() : timer_(VSyncTimeSource::create(&provider_)) { | 35 VSyncTimeSourceTest() : timer_(VSyncTimeSource::Create(&provider_)) { |
| 36 timer_->SetClient(&client_); | 36 timer_->SetClient(&client_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 FakeTimeSourceClient client_; | 40 FakeTimeSourceClient client_; |
| 41 FakeVSyncProvider provider_; | 41 FakeVSyncProvider provider_; |
| 42 scoped_refptr<VSyncTimeSource> timer_; | 42 scoped_refptr<VSyncTimeSource> timer_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 TEST_F(VSyncTimeSourceTest, TaskPostedAndTickCalled) { | 45 TEST_F(VSyncTimeSourceTest, TaskPostedAndTickCalled) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 timer_->SetActive(true); | 89 timer_->SetActive(true); |
| 90 provider_.Trigger(frame_time); | 90 provider_.Trigger(frame_time); |
| 91 ASSERT_EQ(timer_->NextTickTime(), frame_time); | 91 ASSERT_EQ(timer_->NextTickTime(), frame_time); |
| 92 | 92 |
| 93 timer_->SetTimebaseAndInterval(frame_time, interval); | 93 timer_->SetTimebaseAndInterval(frame_time, interval); |
| 94 ASSERT_EQ(timer_->NextTickTime(), frame_time + interval); | 94 ASSERT_EQ(timer_->NextTickTime(), frame_time + interval); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace | 97 } // namespace |
| 98 } // namespace cc | 98 } // namespace cc |
| OLD | NEW |