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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/test/simple_test_tick_clock.h" | 6 #include "base/test/simple_test_tick_clock.h" |
7 #include "media/base/test_helpers.h" | 7 #include "media/base/test_helpers.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/filters/video_frame_scheduler_impl.h" | 9 #include "media/filters/video_frame_scheduler_impl.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
| 15 using testing::_; |
| 16 |
15 // NOTE: millisecond-level resolution is used for times as real delayed tasks | 17 // NOTE: millisecond-level resolution is used for times as real delayed tasks |
16 // are posted. Don't use large values if you want to keep tests running fast. | 18 // are posted. Don't use large values if you want to keep tests running fast. |
17 class VideoFrameSchedulerImplTest : public testing::Test { | 19 class VideoFrameSchedulerImplTest : public testing::Test { |
18 public: | 20 public: |
19 VideoFrameSchedulerImplTest() | 21 VideoFrameSchedulerImplTest() |
20 : scheduler_(message_loop_.message_loop_proxy(), | 22 : scheduler_(message_loop_.message_loop_proxy(), |
21 base::Bind(&VideoFrameSchedulerImplTest::OnDisplay, | 23 base::Bind(&VideoFrameSchedulerImplTest::OnDisplay, |
22 base::Unretained(this))), | 24 base::Unretained(this))), |
23 tick_clock_(new base::SimpleTestTickClock()) { | 25 tick_clock_(new base::SimpleTestTickClock()) { |
24 scheduler_.SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); | 26 scheduler_.SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 EXPECT_CALL(*this, OnFrameDone(displayed, VideoFrameScheduler::DISPLAYED)); | 133 EXPECT_CALL(*this, OnFrameDone(displayed, VideoFrameScheduler::DISPLAYED)); |
132 AdvanceTime(30); | 134 AdvanceTime(30); |
133 RunUntilTimeHasElapsed(30); | 135 RunUntilTimeHasElapsed(30); |
134 } | 136 } |
135 | 137 |
136 TEST_F(VideoFrameSchedulerImplTest, Reset) { | 138 TEST_F(VideoFrameSchedulerImplTest, Reset) { |
137 scoped_refptr<VideoFrame> frame = | 139 scoped_refptr<VideoFrame> frame = |
138 VideoFrame::CreateBlackFrame(gfx::Size(8, 8)); | 140 VideoFrame::CreateBlackFrame(gfx::Size(8, 8)); |
139 Schedule(frame, 10); | 141 Schedule(frame, 10); |
140 | 142 |
141 // Despite being on time, frames are returned immediately. | 143 // Despite being on time, frame callback isn't run. |
142 EXPECT_CALL(*this, OnFrameDone(frame, VideoFrameScheduler::RESET)); | 144 EXPECT_CALL(*this, OnFrameDone(_, _)).Times(0); |
143 AdvanceTime(10); | 145 AdvanceTime(10); |
144 Reset(); | 146 Reset(); |
145 RunUntilTimeHasElapsed(10); | 147 RunUntilTimeHasElapsed(10); |
146 } | 148 } |
147 | 149 |
148 } // namespace media | 150 } // namespace media |
OLD | NEW |