| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/location.h" | 6 #include "base/location.h" |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void SetUp() override { | 37 void SetUp() override { |
| 38 ASSERT_TRUE(vda_thread_.Start()); | 38 ASSERT_TRUE(vda_thread_.Start()); |
| 39 vda_task_runner_ = vda_thread_.task_runner(); | 39 vda_task_runner_ = vda_thread_.task_runner(); |
| 40 mock_vda_ = new media::MockVideoDecodeAccelerator; | 40 mock_vda_ = new media::MockVideoDecodeAccelerator; |
| 41 | 41 |
| 42 media::VideoDecodeAccelerator::SupportedProfile supported_profile; | 42 media::VideoDecodeAccelerator::SupportedProfile supported_profile; |
| 43 supported_profile.min_resolution.SetSize(16, 16); | 43 supported_profile.min_resolution.SetSize(16, 16); |
| 44 supported_profile.max_resolution.SetSize(1920, 1088); | 44 supported_profile.max_resolution.SetSize(1920, 1088); |
| 45 supported_profile.profile = media::H264PROFILE_MAIN; | 45 supported_profile.profile = media::H264PROFILE_MAIN; |
| 46 supported_profiles_.push_back(supported_profile); | 46 capabilities_.supported_profiles.push_back(supported_profile); |
| 47 supported_profile.profile = media::VP8PROFILE_ANY; | 47 supported_profile.profile = media::VP8PROFILE_ANY; |
| 48 supported_profiles_.push_back(supported_profile); | 48 capabilities_.supported_profiles.push_back(supported_profile); |
| 49 | 49 |
| 50 EXPECT_CALL(*mock_gpu_factories_.get(), GetTaskRunner()) | 50 EXPECT_CALL(*mock_gpu_factories_.get(), GetTaskRunner()) |
| 51 .WillRepeatedly(Return(vda_task_runner_)); | 51 .WillRepeatedly(Return(vda_task_runner_)); |
| 52 EXPECT_CALL(*mock_gpu_factories_.get(), | 52 EXPECT_CALL(*mock_gpu_factories_.get(), |
| 53 GetVideoDecodeAcceleratorSupportedProfiles()) | 53 GetVideoDecodeAcceleratorCapabilities()) |
| 54 .WillRepeatedly(Return(supported_profiles_)); | 54 .WillRepeatedly(Return(capabilities_)); |
| 55 EXPECT_CALL(*mock_gpu_factories_.get(), DoCreateVideoDecodeAccelerator()) | 55 EXPECT_CALL(*mock_gpu_factories_.get(), DoCreateVideoDecodeAccelerator()) |
| 56 .WillRepeatedly(Return(mock_vda_)); | 56 .WillRepeatedly(Return(mock_vda_)); |
| 57 EXPECT_CALL(*mock_vda_, Initialize(_, _)) | 57 EXPECT_CALL(*mock_vda_, Initialize(_, _)) |
| 58 .Times(1) | 58 .Times(1) |
| 59 .WillRepeatedly(Return(true)); | 59 .WillRepeatedly(Return(true)); |
| 60 EXPECT_CALL(*mock_vda_, Destroy()).Times(1); | 60 EXPECT_CALL(*mock_vda_, Destroy()).Times(1); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void TearDown() override { | 63 void TearDown() override { |
| 64 DVLOG(2) << "TearDown"; | 64 DVLOG(2) << "TearDown"; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 base::Unretained(&idle_waiter_))); | 105 base::Unretained(&idle_waiter_))); |
| 106 idle_waiter_.Wait(); | 106 idle_waiter_.Wait(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 scoped_ptr<media::MockGpuVideoAcceleratorFactories> mock_gpu_factories_; | 110 scoped_ptr<media::MockGpuVideoAcceleratorFactories> mock_gpu_factories_; |
| 111 media::MockVideoDecodeAccelerator* mock_vda_; | 111 media::MockVideoDecodeAccelerator* mock_vda_; |
| 112 scoped_ptr<RTCVideoDecoder> rtc_decoder_; | 112 scoped_ptr<RTCVideoDecoder> rtc_decoder_; |
| 113 webrtc::VideoCodec codec_; | 113 webrtc::VideoCodec codec_; |
| 114 base::Thread vda_thread_; | 114 base::Thread vda_thread_; |
| 115 media::VideoDecodeAccelerator::SupportedProfiles supported_profiles_; | 115 media::VideoDecodeAccelerator::Capabilities capabilities_; |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; | 118 scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_; |
| 119 | 119 |
| 120 base::Lock lock_; | 120 base::Lock lock_; |
| 121 base::WaitableEvent idle_waiter_; | 121 base::WaitableEvent idle_waiter_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) { | 124 TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) { |
| 125 CreateDecoder(webrtc::kVideoCodecVP8); | 125 CreateDecoder(webrtc::kVideoCodecVP8); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, | 237 EXPECT_FALSE(rtc_decoder_->IsFirstBufferAfterReset(RTCVideoDecoder::ID_LAST, |
| 238 RTCVideoDecoder::ID_LAST)); | 238 RTCVideoDecoder::ID_LAST)); |
| 239 EXPECT_TRUE( | 239 EXPECT_TRUE( |
| 240 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); | 240 rtc_decoder_->IsFirstBufferAfterReset(0, RTCVideoDecoder::ID_LAST)); |
| 241 EXPECT_FALSE( | 241 EXPECT_FALSE( |
| 242 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); | 242 rtc_decoder_->IsFirstBufferAfterReset(1, RTCVideoDecoder::ID_LAST)); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // content | 245 } // content |
| OLD | NEW |