Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 19534002: Make RendererGpuVideoDecoderFactories live on arbitrary threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/rtc_video_decoder_unittest.cc
diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc
index 5bb0f0430a26655806f9d00936138ff9787afc90..746bddbe90347724870b8959c0f368b9878cdd9d 100644
--- a/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -37,19 +37,25 @@ class RTCVideoDecoderTest : public ::testing::Test,
mock_vda_ = new media::MockVideoDecodeAccelerator;
EXPECT_CALL(*mock_gpu_factories_, GetMessageLoop())
.WillRepeatedly(Return(vda_loop_proxy_));
+ EXPECT_CALL(*mock_gpu_factories_, CreateVideoDecodeAccelerator(_, _))
+ .WillRepeatedly(
+ Return(static_cast<media::VideoDecodeAccelerator*>(NULL)));
EXPECT_CALL(*mock_gpu_factories_,
CreateVideoDecodeAccelerator(media::VP8PROFILE_MAIN, _))
- .WillOnce(Return(mock_vda_));
+ .WillRepeatedly(Return(mock_vda_));
EXPECT_CALL(*mock_gpu_factories_, Abort()).WillRepeatedly(Return());
EXPECT_CALL(*mock_gpu_factories_, CreateSharedMemory(_))
.WillRepeatedly(Return(static_cast<base::SharedMemory*>(NULL)));
EXPECT_CALL(*mock_vda_, Destroy());
- rtc_decoder_ = RTCVideoDecoder::Create(mock_gpu_factories_);
+ rtc_decoder_ = RTCVideoDecoder::Create(
+ webrtc::kVideoCodecVP8, vda_loop_proxy_, mock_gpu_factories_);
}
virtual void TearDown() OVERRIDE {
VLOG(2) << "TearDown";
if (vda_thread_.IsRunning()) {
+ if (rtc_decoder_)
+ rtc_decoder_->Release();
RunUntilIdle(); // Wait until all callbascks complete.
vda_loop_proxy_->DeleteSoon(FROM_HERE, rtc_decoder_.release());
// Make sure the decoder is released before stopping the thread.
@@ -103,6 +109,14 @@ class RTCVideoDecoderTest : public ::testing::Test,
base::WaitableEvent idle_waiter_;
};
+TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) {
+ scoped_ptr<RTCVideoDecoder> null_rtc_decoder(
+ RTCVideoDecoder::Create(webrtc::kVideoCodecI420,
+ vda_thread_.message_loop_proxy(),
+ mock_gpu_factories_));
+ EXPECT_EQ(NULL, null_rtc_decoder.get());
+}
+
TEST_F(RTCVideoDecoderTest, InitDecodeReturnsErrorOnFeedbackMode) {
codec_.codecType = webrtc::kVideoCodecVP8;
codec_.codecSpecific.VP8.feedbackModeOn = true;
@@ -141,8 +155,6 @@ TEST_F(RTCVideoDecoderTest, ResetReturnsOk) {
TEST_F(RTCVideoDecoderTest, ReleaseReturnsOk) {
Initialize();
- EXPECT_CALL(*mock_vda_, Reset())
- .WillOnce(Invoke(this, &RTCVideoDecoderTest::NotifyResetDone));
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, rtc_decoder_->Release());
}
Ami GONE FROM CHROMIUM 2013/07/22 19:46:21 Where's the test that multiple decoders can be cre
wuchengli 2013/07/23 16:29:28 Good point. That should be a new test file because

Powered by Google App Engine
This is Rietveld 408576698