| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/media/rtc_video_decoder.h" | 5 #include "content/renderer/media/rtc_video_decoder.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 using ::testing::Return; | 27 using ::testing::Return; |
| 28 using ::testing::ReturnNull; | 28 using ::testing::ReturnNull; |
| 29 using ::testing::SetArgumentPointee; | 29 using ::testing::SetArgumentPointee; |
| 30 using ::testing::StrictMock; | 30 using ::testing::StrictMock; |
| 31 using ::testing::WithArg; | 31 using ::testing::WithArg; |
| 32 using ::testing::Invoke; | 32 using ::testing::Invoke; |
| 33 using media::MockStatisticsCallback; | 33 using media::MockStatisticsCallback; |
| 34 using media::MockVideoRenderer; | 34 using media::MockVideoRenderer; |
| 35 using media::MockFilterHost; | 35 using media::MockFilterHost; |
| 36 using media::NewExpectedClosure; | 36 using media::NewExpectedClosure; |
| 37 using media::NewExpectedStatusCB; |
| 37 using media::PipelineStatistics; | 38 using media::PipelineStatistics; |
| 38 using media::PIPELINE_OK; | 39 using media::PIPELINE_OK; |
| 39 using media::StatisticsCallback; | 40 using media::StatisticsCallback; |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 class NullVideoFrame : public cricket::VideoFrame { | 44 class NullVideoFrame : public cricket::VideoFrame { |
| 44 public: | 45 public: |
| 45 NullVideoFrame() {}; | 46 NullVideoFrame() {}; |
| 46 virtual ~NullVideoFrame() {}; | 47 virtual ~NullVideoFrame() {}; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 .Times(AnyNumber()); | 126 .Times(AnyNumber()); |
| 126 } | 127 } |
| 127 | 128 |
| 128 virtual ~RTCVideoDecoderTest() { | 129 virtual ~RTCVideoDecoderTest() { |
| 129 // Finish up any remaining tasks. | 130 // Finish up any remaining tasks. |
| 130 message_loop_.RunAllPending(); | 131 message_loop_.RunAllPending(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void InitializeDecoderSuccessfully() { | 134 void InitializeDecoderSuccessfully() { |
| 134 // Test successful initialization. | 135 // Test successful initialization. |
| 135 decoder_->Initialize(NULL, | 136 decoder_->Initialize( |
| 136 NewExpectedClosure(), NewStatisticsCallback()); | 137 NULL, NewExpectedStatusCB(PIPELINE_OK), NewStatisticsCallback()); |
| 137 message_loop_.RunAllPending(); | 138 message_loop_.RunAllPending(); |
| 138 } | 139 } |
| 139 | 140 |
| 140 StatisticsCallback NewStatisticsCallback() { | 141 StatisticsCallback NewStatisticsCallback() { |
| 141 return base::Bind(&MockStatisticsCallback::OnStatistics, | 142 return base::Bind(&MockStatisticsCallback::OnStatistics, |
| 142 base::Unretained(&stats_callback_object_)); | 143 base::Unretained(&stats_callback_object_)); |
| 143 } | 144 } |
| 144 | 145 |
| 145 MOCK_METHOD1(FrameReady, void(scoped_refptr<media::VideoFrame>)); | 146 MOCK_METHOD1(FrameReady, void(scoped_refptr<media::VideoFrame>)); |
| 146 | 147 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 EXPECT_CALL(host_, | 224 EXPECT_CALL(host_, |
| 224 SetNaturalVideoSize(new_natural_size)).WillRepeatedly(Return()); | 225 SetNaturalVideoSize(new_natural_size)).WillRepeatedly(Return()); |
| 225 | 226 |
| 226 decoder_->SetSize(new_width, new_height, new_reserved); | 227 decoder_->SetSize(new_width, new_height, new_reserved); |
| 227 | 228 |
| 228 EXPECT_EQ(new_width, decoder_->natural_size().width()); | 229 EXPECT_EQ(new_width, decoder_->natural_size().width()); |
| 229 EXPECT_EQ(new_height, decoder_->natural_size().height()); | 230 EXPECT_EQ(new_height, decoder_->natural_size().height()); |
| 230 | 231 |
| 231 message_loop_.RunAllPending(); | 232 message_loop_.RunAllPending(); |
| 232 } | 233 } |
| OLD | NEW |