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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/test/simple_test_tick_clock.h" | 9 #include "base/test/simple_test_tick_clock.h" |
10 #include "cc/layers/video_frame_provider.h" | 10 #include "cc/layers/video_frame_provider.h" |
| 11 #include "media/base/gmock_callback_support.h" |
11 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
12 #include "media/blink/video_frame_compositor.h" | 13 #include "media/blink/video_frame_compositor.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 using testing::_; | 17 using testing::_; |
17 using testing::DoAll; | 18 using testing::DoAll; |
18 using testing::Return; | 19 using testing::Return; |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
22 ACTION_P(RunClosure, closure) { | |
23 closure.Run(); | |
24 } | |
25 | |
26 class VideoFrameCompositorTest : public testing::Test, | 23 class VideoFrameCompositorTest : public testing::Test, |
27 public cc::VideoFrameProvider::Client, | 24 public cc::VideoFrameProvider::Client, |
28 public VideoRendererSink::RenderCallback { | 25 public VideoRendererSink::RenderCallback { |
29 public: | 26 public: |
30 VideoFrameCompositorTest() | 27 VideoFrameCompositorTest() |
31 : tick_clock_(new base::SimpleTestTickClock()), | 28 : tick_clock_(new base::SimpleTestTickClock()), |
32 compositor_(new VideoFrameCompositor(message_loop.task_runner())), | 29 compositor_(new VideoFrameCompositor(message_loop.task_runner())), |
33 did_receive_frame_count_(0) { | 30 did_receive_frame_count_(0) { |
34 compositor_->SetVideoFrameProviderClient(this); | 31 compositor_->SetVideoFrameProviderClient(this); |
35 compositor_->set_tick_clock_for_testing( | 32 compositor_->set_tick_clock_for_testing( |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 256 |
260 // Advancing the tick clock should allow a new frame to be requested. | 257 // Advancing the tick clock should allow a new frame to be requested. |
261 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); | 258 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); |
262 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale()); | 259 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale()); |
263 | 260 |
264 // Background rendering should tick another render callback. | 261 // Background rendering should tick another render callback. |
265 StopVideoRendererSink(false); | 262 StopVideoRendererSink(false); |
266 } | 263 } |
267 | 264 |
268 } // namespace media | 265 } // namespace media |
OLD | NEW |