summaryrefslogtreecommitdiffstats
path: root/chromium/content/renderer/media/rtc_video_decoder_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/renderer/media/rtc_video_decoder_unittest.cc')
-rw-r--r--chromium/content/renderer/media/rtc_video_decoder_unittest.cc52
1 files changed, 23 insertions, 29 deletions
diff --git a/chromium/content/renderer/media/rtc_video_decoder_unittest.cc b/chromium/content/renderer/media/rtc_video_decoder_unittest.cc
index ba27a576765..e6dfe3eeaa1 100644
--- a/chromium/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/chromium/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -33,40 +33,35 @@ class RTCVideoDecoderTest : public ::testing::Test,
virtual void SetUp() OVERRIDE {
ASSERT_TRUE(vda_thread_.Start());
- vda_loop_proxy_ = vda_thread_.message_loop_proxy();
+ vda_task_runner_ = vda_thread_.message_loop_proxy();
mock_vda_ = new media::MockVideoDecodeAccelerator;
- EXPECT_CALL(*mock_gpu_factories_, GetMessageLoop())
- .WillRepeatedly(Return(vda_loop_proxy_));
- EXPECT_CALL(*mock_gpu_factories_, DoCreateVideoDecodeAccelerator(_, _))
- .WillRepeatedly(
- Return(static_cast<media::VideoDecodeAccelerator*>(NULL)));
- EXPECT_CALL(*mock_gpu_factories_,
- DoCreateVideoDecodeAccelerator(media::VP8PROFILE_MAIN, _))
+ EXPECT_CALL(*mock_gpu_factories_, GetTaskRunner())
+ .WillRepeatedly(Return(vda_task_runner_));
+ EXPECT_CALL(*mock_gpu_factories_, DoCreateVideoDecodeAccelerator())
.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());
+ EXPECT_CALL(*mock_vda_, Initialize(_, _))
+ .Times(1)
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_vda_, Destroy()).Times(1);
rtc_decoder_ =
RTCVideoDecoder::Create(webrtc::kVideoCodecVP8, mock_gpu_factories_);
}
virtual void TearDown() OVERRIDE {
VLOG(2) << "TearDown";
- if (vda_thread_.IsRunning()) {
- 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.
- RunUntilIdle();
- vda_thread_.Stop();
- } else {
- rtc_decoder_.reset();
- }
+ EXPECT_TRUE(vda_thread_.IsRunning());
+ RunUntilIdle(); // Wait until all callbascks complete.
+ vda_task_runner_->DeleteSoon(FROM_HERE, rtc_decoder_.release());
+ // Make sure the decoder is released before stopping the thread.
+ RunUntilIdle();
+ vda_thread_.Stop();
}
virtual int32_t Decoded(webrtc::I420VideoFrame& decoded_image) OVERRIDE {
VLOG(2) << "Decoded";
- EXPECT_EQ(vda_loop_proxy_, base::MessageLoopProxy::current());
+ EXPECT_EQ(vda_task_runner_, base::MessageLoopProxy::current());
return WEBRTC_VIDEO_CODEC_OK;
}
@@ -80,16 +75,17 @@ class RTCVideoDecoderTest : public ::testing::Test,
void NotifyResetDone() {
VLOG(2) << "NotifyResetDone";
- vda_loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&RTCVideoDecoder::NotifyResetDone,
- base::Unretained(rtc_decoder_.get())));
+ vda_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&RTCVideoDecoder::NotifyResetDone,
+ base::Unretained(rtc_decoder_.get())));
}
void RunUntilIdle() {
VLOG(2) << "RunUntilIdle";
- vda_loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&base::WaitableEvent::Signal,
- base::Unretained(&idle_waiter_)));
+ vda_task_runner_->PostTask(FROM_HERE,
+ base::Bind(&base::WaitableEvent::Signal,
+ base::Unretained(&idle_waiter_)));
idle_waiter_.Wait();
}
@@ -101,7 +97,7 @@ class RTCVideoDecoderTest : public ::testing::Test,
base::Thread vda_thread_;
private:
- scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_;
+ scoped_refptr<base::SingleThreadTaskRunner> vda_task_runner_;
base::Lock lock_;
base::WaitableEvent idle_waiter_;
@@ -165,8 +161,6 @@ TEST_F(RTCVideoDecoderTest, InitDecodeAfterRelease) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, rtc_decoder_->Release());
}
-TEST_F(RTCVideoDecoderTest, VdaThreadStops) { vda_thread_.Stop(); }
-
TEST_F(RTCVideoDecoderTest, IsBufferAfterReset) {
EXPECT_TRUE(rtc_decoder_->IsBufferAfterReset(0, RTCVideoDecoder::ID_INVALID));
EXPECT_TRUE(rtc_decoder_->IsBufferAfterReset(RTCVideoDecoder::ID_LAST,