| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/test/simple_test_tick_clock.h" | 11 #include "base/test/simple_test_tick_clock.h" |
| 12 #include "media/base/gmock_callback_support.h" |
| 12 #include "media/base/null_video_sink.h" | 13 #include "media/base/null_video_sink.h" |
| 13 #include "media/base/test_helpers.h" | 14 #include "media/base/test_helpers.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using testing::_; | 18 using testing::_; |
| 18 using testing::DoAll; | 19 using testing::DoAll; |
| 19 using testing::Return; | 20 using testing::Return; |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 | 23 |
| 23 ACTION_P(RunClosure, closure) { | |
| 24 closure.Run(); | |
| 25 } | |
| 26 | |
| 27 class NullVideoSinkTest : public testing::Test, | 24 class NullVideoSinkTest : public testing::Test, |
| 28 public VideoRendererSink::RenderCallback { | 25 public VideoRendererSink::RenderCallback { |
| 29 public: | 26 public: |
| 30 NullVideoSinkTest() { | 27 NullVideoSinkTest() { |
| 31 // Never use null TimeTicks since they have special connotations. | 28 // Never use null TimeTicks since they have special connotations. |
| 32 tick_clock_.Advance(base::TimeDelta::FromMicroseconds(12345)); | 29 tick_clock_.Advance(base::TimeDelta::FromMicroseconds(12345)); |
| 33 } | 30 } |
| 34 ~NullVideoSinkTest() override {} | 31 ~NullVideoSinkTest() override {} |
| 35 | 32 |
| 36 std::unique_ptr<NullVideoSink> ConstructSink(bool clockless, | 33 std::unique_ptr<NullVideoSink> ConstructSink(bool clockless, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 .WillOnce( | 143 .WillOnce( |
| 147 DoAll(RunClosure(event.GetClosure()), Return(test_frame_2))); | 144 DoAll(RunClosure(event.GetClosure()), Return(test_frame_2))); |
| 148 } | 145 } |
| 149 } | 146 } |
| 150 event.RunAndWait(); | 147 event.RunAndWait(); |
| 151 ASSERT_LT(base::TimeTicks::Now() - now, kTestRuns * interval); | 148 ASSERT_LT(base::TimeTicks::Now() - now, kTestRuns * interval); |
| 152 sink->Stop(); | 149 sink->Stop(); |
| 153 } | 150 } |
| 154 | 151 |
| 155 } // namespace media | 152 } // namespace media |
| OLD | NEW |