| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/test/simple_test_tick_clock.h" | 6 #include "base/test/simple_test_tick_clock.h" |
| 7 #include "media/base/time_delta_interpolator.h" | 7 #include "media/base/time_delta_interpolator.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 class TimeDeltaInterpolatorTest : public ::testing::Test { | 12 class TimeDeltaInterpolatorTest : public ::testing::Test { |
| 13 public: | 13 public: |
| 14 TimeDeltaInterpolatorTest() : interpolator_(&test_tick_clock_) {} | 14 TimeDeltaInterpolatorTest() : interpolator_(&test_tick_clock_) { |
| 15 interpolator_.SetPlaybackRate(1.0); |
| 16 } |
| 15 | 17 |
| 16 protected: | 18 protected: |
| 17 void AdvanceSystemTime(base::TimeDelta delta) { | 19 void AdvanceSystemTime(base::TimeDelta delta) { |
| 18 test_tick_clock_.Advance(delta); | 20 test_tick_clock_.Advance(delta); |
| 19 } | 21 } |
| 20 | 22 |
| 21 base::SimpleTestTickClock test_tick_clock_; | 23 base::SimpleTestTickClock test_tick_clock_; |
| 22 TimeDeltaInterpolator interpolator_; | 24 TimeDeltaInterpolator interpolator_; |
| 23 }; | 25 }; |
| 24 | 26 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 EXPECT_EQ(kMaxTime1, interpolator_.GetInterpolatedTime()); | 192 EXPECT_EQ(kMaxTime1, interpolator_.GetInterpolatedTime()); |
| 191 | 193 |
| 192 AdvanceSystemTime(kTimeInterval); | 194 AdvanceSystemTime(kTimeInterval); |
| 193 EXPECT_EQ(kMaxTime1 + kTimeInterval, interpolator_.GetInterpolatedTime()); | 195 EXPECT_EQ(kMaxTime1 + kTimeInterval, interpolator_.GetInterpolatedTime()); |
| 194 | 196 |
| 195 AdvanceSystemTime(kTimeInterval); | 197 AdvanceSystemTime(kTimeInterval); |
| 196 EXPECT_EQ(kMaxTime2, interpolator_.GetInterpolatedTime()); | 198 EXPECT_EQ(kMaxTime2, interpolator_.GetInterpolatedTime()); |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace media | 201 } // namespace media |
| OLD | NEW |