| 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 12 matching lines...) Expand all Loading... |
| 23 using ::testing::_; | 23 using ::testing::_; |
| 24 using ::testing::AnyNumber; | 24 using ::testing::AnyNumber; |
| 25 using ::testing::DoAll; | 25 using ::testing::DoAll; |
| 26 using ::testing::Message; | 26 using ::testing::Message; |
| 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::Limits; | |
| 34 using media::MockStatisticsCallback; | 33 using media::MockStatisticsCallback; |
| 35 using media::MockVideoRenderer; | 34 using media::MockVideoRenderer; |
| 36 using media::MockFilterHost; | 35 using media::MockFilterHost; |
| 37 using media::NewExpectedClosure; | 36 using media::NewExpectedClosure; |
| 38 using media::PipelineStatistics; | 37 using media::PipelineStatistics; |
| 39 using media::PIPELINE_OK; | 38 using media::PIPELINE_OK; |
| 40 using media::StatisticsCallback; | 39 using media::StatisticsCallback; |
| 41 | 40 |
| 42 namespace { | 41 namespace { |
| 43 | 42 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 197 } |
| 199 | 198 |
| 200 TEST_F(RTCVideoDecoderTest, DoRenderFrame) { | 199 TEST_F(RTCVideoDecoderTest, DoRenderFrame) { |
| 201 const base::TimeDelta kZero; | 200 const base::TimeDelta kZero; |
| 202 EXPECT_CALL(host_, GetTime()).WillRepeatedly(Return(base::TimeDelta())); | 201 EXPECT_CALL(host_, GetTime()).WillRepeatedly(Return(base::TimeDelta())); |
| 203 | 202 |
| 204 InitializeDecoderSuccessfully(); | 203 InitializeDecoderSuccessfully(); |
| 205 | 204 |
| 206 NullVideoFrame video_frame; | 205 NullVideoFrame video_frame; |
| 207 | 206 |
| 208 for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) { | 207 for (size_t i = 0; i < media::limits::kMaxVideoFrames; ++i) { |
| 209 decoder_->RenderFrame(&video_frame); | 208 decoder_->RenderFrame(&video_frame); |
| 210 } | 209 } |
| 211 | 210 |
| 212 message_loop_.RunAllPending(); | 211 message_loop_.RunAllPending(); |
| 213 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); | 212 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); |
| 214 } | 213 } |
| 215 | 214 |
| 216 TEST_F(RTCVideoDecoderTest, DoSetSize) { | 215 TEST_F(RTCVideoDecoderTest, DoSetSize) { |
| 217 InitializeDecoderSuccessfully(); | 216 InitializeDecoderSuccessfully(); |
| 218 | 217 |
| 219 int new_width = kWidth * 2; | 218 int new_width = kWidth * 2; |
| 220 int new_height = kHeight * 2; | 219 int new_height = kHeight * 2; |
| 221 gfx::Size new_natural_size(new_width, new_height); | 220 gfx::Size new_natural_size(new_width, new_height); |
| 222 int new_reserved = 0; | 221 int new_reserved = 0; |
| 223 | 222 |
| 224 EXPECT_CALL(host_, | 223 EXPECT_CALL(host_, |
| 225 SetNaturalVideoSize(new_natural_size)).WillRepeatedly(Return()); | 224 SetNaturalVideoSize(new_natural_size)).WillRepeatedly(Return()); |
| 226 | 225 |
| 227 decoder_->SetSize(new_width, new_height, new_reserved); | 226 decoder_->SetSize(new_width, new_height, new_reserved); |
| 228 | 227 |
| 229 EXPECT_EQ(new_width, decoder_->natural_size().width()); | 228 EXPECT_EQ(new_width, decoder_->natural_size().width()); |
| 230 EXPECT_EQ(new_height, decoder_->natural_size().height()); | 229 EXPECT_EQ(new_height, decoder_->natural_size().height()); |
| 231 | 230 |
| 232 message_loop_.RunAllPending(); | 231 message_loop_.RunAllPending(); |
| 233 } | 232 } |
| OLD | NEW |