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 <memory> |
| 6 |
5 #include "base/macros.h" | 7 #include "base/macros.h" |
6 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
7 #include "media/base/wall_clock_time_source.h" | 9 #include "media/base/wall_clock_time_source.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
9 | 11 |
10 namespace media { | 12 namespace media { |
11 | 13 |
12 class WallClockTimeSourceTest : public testing::Test { | 14 class WallClockTimeSourceTest : public testing::Test { |
13 public: | 15 public: |
14 WallClockTimeSourceTest() : tick_clock_(new base::SimpleTestTickClock()) { | 16 WallClockTimeSourceTest() : tick_clock_(new base::SimpleTestTickClock()) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 48 |
47 bool IsTimeStopped() { | 49 bool IsTimeStopped() { |
48 bool is_time_moving = false; | 50 bool is_time_moving = false; |
49 // Convert any random value, it shouldn't matter for this call. | 51 // Convert any random value, it shouldn't matter for this call. |
50 ConvertMediaTime(base::TimeDelta::FromSeconds(1), &is_time_moving); | 52 ConvertMediaTime(base::TimeDelta::FromSeconds(1), &is_time_moving); |
51 return !is_time_moving; | 53 return !is_time_moving; |
52 } | 54 } |
53 | 55 |
54 protected: | 56 protected: |
55 WallClockTimeSource time_source_; | 57 WallClockTimeSource time_source_; |
56 scoped_ptr<base::SimpleTestTickClock> tick_clock_; | 58 std::unique_ptr<base::SimpleTestTickClock> tick_clock_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSourceTest); | 60 DISALLOW_COPY_AND_ASSIGN(WallClockTimeSourceTest); |
59 }; | 61 }; |
60 | 62 |
61 TEST_F(WallClockTimeSourceTest, InitialTimeIsZero) { | 63 TEST_F(WallClockTimeSourceTest, InitialTimeIsZero) { |
62 EXPECT_EQ(0, CurrentMediaTimeInSeconds()); | 64 EXPECT_EQ(0, CurrentMediaTimeInSeconds()); |
63 EXPECT_TRUE(IsTimeStopped()); | 65 EXPECT_TRUE(IsTimeStopped()); |
64 } | 66 } |
65 | 67 |
66 TEST_F(WallClockTimeSourceTest, InitialTimeIsNotTicking) { | 68 TEST_F(WallClockTimeSourceTest, InitialTimeIsNotTicking) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 159 |
158 wall_clock_times.clear(); | 160 wall_clock_times.clear(); |
159 time_source_.StopTicking(); | 161 time_source_.StopTicking(); |
160 is_time_moving = time_source_.GetWallClockTimes( | 162 is_time_moving = time_source_.GetWallClockTimes( |
161 std::vector<base::TimeDelta>(), &wall_clock_times); | 163 std::vector<base::TimeDelta>(), &wall_clock_times); |
162 EXPECT_FALSE(is_time_moving); | 164 EXPECT_FALSE(is_time_moving); |
163 EXPECT_EQ(tick_clock_->NowTicks(), wall_clock_times[0]); | 165 EXPECT_EQ(tick_clock_->NowTicks(), wall_clock_times[0]); |
164 } | 166 } |
165 | 167 |
166 } // namespace media | 168 } // namespace media |
OLD | NEW |