| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "media/base/data_buffer.h" | 24 #include "media/base/data_buffer.h" |
| 25 #include "media/base/gmock_callback_support.h" | 25 #include "media/base/gmock_callback_support.h" |
| 26 #include "media/base/limits.h" | 26 #include "media/base/limits.h" |
| 27 #include "media/base/mock_filters.h" | 27 #include "media/base/mock_filters.h" |
| 28 #include "media/base/null_video_sink.h" | 28 #include "media/base/null_video_sink.h" |
| 29 #include "media/base/test_helpers.h" | 29 #include "media/base/test_helpers.h" |
| 30 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
| 31 #include "media/base/wall_clock_time_source.h" | 31 #include "media/base/wall_clock_time_source.h" |
| 32 #include "media/renderers/mock_gpu_memory_buffer_video_frame_pool.h" | 32 #include "media/renderers/mock_gpu_memory_buffer_video_frame_pool.h" |
| 33 #include "media/renderers/video_renderer_impl.h" | 33 #include "media/renderers/video_renderer_impl.h" |
| 34 #include "testing/gmock_mutant.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 35 | 36 |
| 36 using ::testing::_; | 37 using ::testing::_; |
| 37 using ::testing::AnyNumber; | 38 using ::testing::AnyNumber; |
| 39 using ::testing::CreateFunctor; |
| 38 using ::testing::Invoke; | 40 using ::testing::Invoke; |
| 39 using ::testing::Mock; | 41 using ::testing::Mock; |
| 40 using ::testing::NiceMock; | 42 using ::testing::NiceMock; |
| 41 using ::testing::Return; | 43 using ::testing::Return; |
| 42 using ::testing::SaveArg; | 44 using ::testing::SaveArg; |
| 43 using ::testing::StrictMock; | 45 using ::testing::StrictMock; |
| 44 | 46 |
| 45 namespace media { | 47 namespace media { |
| 46 | 48 |
| 47 MATCHER_P(HasTimestampMatcher, ms, "") { | 49 MATCHER_P(HasTimestampMatcher, ms, "") { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 196 |
| 195 bool IsReadPending() { | 197 bool IsReadPending() { |
| 196 return !decode_cb_.is_null(); | 198 return !decode_cb_.is_null(); |
| 197 } | 199 } |
| 198 | 200 |
| 199 void WaitForError(PipelineStatus expected) { | 201 void WaitForError(PipelineStatus expected) { |
| 200 SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected)); | 202 SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected)); |
| 201 | 203 |
| 202 WaitableMessageLoopEvent event; | 204 WaitableMessageLoopEvent event; |
| 203 PipelineStatusCB error_cb = event.GetPipelineStatusCB(); | 205 PipelineStatusCB error_cb = event.GetPipelineStatusCB(); |
| 204 EXPECT_CALL(mock_cb_, OnError(_)) | 206 EXPECT_CALL(mock_cb_, OnError(_)).WillOnce(Invoke(CreateFunctor(error_cb))); |
| 205 .WillOnce(Invoke(&error_cb, &PipelineStatusCB::Run)); | |
| 206 event.RunAndWaitForStatus(expected); | 207 event.RunAndWaitForStatus(expected); |
| 207 } | 208 } |
| 208 | 209 |
| 209 void WaitForEnded() { | 210 void WaitForEnded() { |
| 210 SCOPED_TRACE("WaitForEnded()"); | 211 SCOPED_TRACE("WaitForEnded()"); |
| 211 | 212 |
| 212 WaitableMessageLoopEvent event; | 213 WaitableMessageLoopEvent event; |
| 213 EXPECT_CALL(mock_cb_, OnEnded()).WillOnce(RunClosure(event.GetClosure())); | 214 EXPECT_CALL(mock_cb_, OnEnded()).WillOnce(RunClosure(event.GetClosure())); |
| 214 event.RunAndWait(); | 215 event.RunAndWait(); |
| 215 } | 216 } |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 QueueFrames("0 10 20 30"); | 1186 QueueFrames("0 10 20 30"); |
| 1186 StartPlayingFrom(0); | 1187 StartPlayingFrom(0); |
| 1187 Flush(); | 1188 Flush(); |
| 1188 ASSERT_EQ(1u, frame_ready_cbs_.size()); | 1189 ASSERT_EQ(1u, frame_ready_cbs_.size()); |
| 1189 // This frame will be discarded. | 1190 // This frame will be discarded. |
| 1190 frame_ready_cbs_.front().Run(); | 1191 frame_ready_cbs_.front().Run(); |
| 1191 Destroy(); | 1192 Destroy(); |
| 1192 } | 1193 } |
| 1193 | 1194 |
| 1194 } // namespace media | 1195 } // namespace media |
| OLD | NEW |