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/test/simple_test_tick_clock.h" | 5 #include "base/test/simple_test_tick_clock.h" |
6 #include "media/base/wall_clock_time_source.h" | 6 #include "media/base/wall_clock_time_source.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
11 class WallClockTimeSourceTest : public testing::Test { | 11 class WallClockTimeSourceTest : public testing::Test { |
12 public: | 12 public: |
13 WallClockTimeSourceTest() : tick_clock_(new base::SimpleTestTickClock()) { | 13 WallClockTimeSourceTest() : tick_clock_(new base::SimpleTestTickClock()) { |
14 time_source_.SetTickClockForTesting( | 14 time_source_.SetTickClockForTesting( |
15 scoped_ptr<base::TickClock>(tick_clock_)); | 15 scoped_ptr<base::TickClock>(tick_clock_)); |
16 } | 16 } |
17 virtual ~WallClockTimeSourceTest() {} | 17 ~WallClockTimeSourceTest() override {} |
18 | 18 |
19 void AdvanceTimeInSeconds(int seconds) { | 19 void AdvanceTimeInSeconds(int seconds) { |
20 tick_clock_->Advance(base::TimeDelta::FromSeconds(seconds)); | 20 tick_clock_->Advance(base::TimeDelta::FromSeconds(seconds)); |
21 } | 21 } |
22 | 22 |
23 int CurrentMediaTimeInSeconds() { | 23 int CurrentMediaTimeInSeconds() { |
24 return time_source_.CurrentMediaTime().InSeconds(); | 24 return time_source_.CurrentMediaTime().InSeconds(); |
25 } | 25 } |
26 | 26 |
27 void SetMediaTimeInSeconds(int seconds) { | 27 void SetMediaTimeInSeconds(int seconds) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 AdvanceTimeInSeconds(10); | 81 AdvanceTimeInSeconds(10); |
82 EXPECT_EQ(10, CurrentMediaTimeInSeconds()); | 82 EXPECT_EQ(10, CurrentMediaTimeInSeconds()); |
83 | 83 |
84 time_source_.StopTicking(); | 84 time_source_.StopTicking(); |
85 | 85 |
86 AdvanceTimeInSeconds(10); | 86 AdvanceTimeInSeconds(10); |
87 EXPECT_EQ(10, CurrentMediaTimeInSeconds()); | 87 EXPECT_EQ(10, CurrentMediaTimeInSeconds()); |
88 } | 88 } |
89 | 89 |
90 } // namespace media | 90 } // namespace media |
OLD | NEW |