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

Unified Diff: media/video/ffmpeg_video_decode_engine_unittest.cc

Issue 6541037: Revert 75444 - Move MockFFmpeg instance setting into the constructor/destruct... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/ffmpeg_video_decode_engine_unittest.cc
===================================================================
--- media/video/ffmpeg_video_decode_engine_unittest.cc (revision 75447)
+++ media/video/ffmpeg_video_decode_engine_unittest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -68,6 +68,9 @@
buffer_ = new DataBuffer(1);
+ // Initialize MockFFmpeg.
+ MockFFmpeg::set(&mock_ffmpeg_);
+
test_engine_.reset(new FFmpegVideoDecodeEngine());
test_engine_->SetCodecContextForTest(&codec_context_);
@@ -81,18 +84,19 @@
~FFmpegVideoDecodeEngineTest() {
test_engine_.reset();
+ MockFFmpeg::set(NULL);
}
void Initialize() {
- EXPECT_CALL(mock_ffmpeg_, AVCodecFindDecoder(CODEC_ID_NONE))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecFindDecoder(CODEC_ID_NONE))
.WillOnce(Return(&codec_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecAllocFrame())
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecAllocFrame())
.WillOnce(Return(&yuv_frame_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecThreadInit(&codec_context_, 2))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecThreadInit(&codec_context_, 2))
.WillOnce(Return(0));
- EXPECT_CALL(mock_ffmpeg_, AVCodecOpen(&codec_context_, &codec_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecOpen(&codec_context_, &codec_))
.WillOnce(Return(0));
- EXPECT_CALL(mock_ffmpeg_, AVFree(&yuv_frame_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVFree(&yuv_frame_))
.Times(1);
config_.codec = kCodecH264;
@@ -162,11 +166,11 @@
TEST_F(FFmpegVideoDecodeEngineTest, Initialize_FindDecoderFails) {
// Test avcodec_find_decoder() returning NULL.
- EXPECT_CALL(mock_ffmpeg_, AVCodecFindDecoder(CODEC_ID_NONE))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecFindDecoder(CODEC_ID_NONE))
.WillOnce(ReturnNull());
- EXPECT_CALL(mock_ffmpeg_, AVCodecAllocFrame())
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecAllocFrame())
.WillOnce(Return(&yuv_frame_));
- EXPECT_CALL(mock_ffmpeg_, AVFree(&yuv_frame_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVFree(&yuv_frame_))
.Times(1);
config_.codec = kCodecH264;
@@ -182,13 +186,13 @@
// Note There are 2 threads for FFmpeg-mt.
TEST_F(FFmpegVideoDecodeEngineTest, Initialize_InitThreadFails) {
// Test avcodec_thread_init() failing.
- EXPECT_CALL(mock_ffmpeg_, AVCodecFindDecoder(CODEC_ID_NONE))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecFindDecoder(CODEC_ID_NONE))
.WillOnce(Return(&codec_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecAllocFrame())
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecAllocFrame())
.WillOnce(Return(&yuv_frame_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecThreadInit(&codec_context_, 2))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecThreadInit(&codec_context_, 2))
.WillOnce(Return(-1));
- EXPECT_CALL(mock_ffmpeg_, AVFree(&yuv_frame_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVFree(&yuv_frame_))
.Times(1);
config_.codec = kCodecH264;
@@ -203,15 +207,15 @@
TEST_F(FFmpegVideoDecodeEngineTest, Initialize_OpenDecoderFails) {
// Test avcodec_open() failing.
- EXPECT_CALL(mock_ffmpeg_, AVCodecFindDecoder(CODEC_ID_NONE))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecFindDecoder(CODEC_ID_NONE))
.WillOnce(Return(&codec_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecAllocFrame())
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecAllocFrame())
.WillOnce(Return(&yuv_frame_));
- EXPECT_CALL(mock_ffmpeg_, AVCodecThreadInit(&codec_context_, 2))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecThreadInit(&codec_context_, 2))
.WillOnce(Return(0));
- EXPECT_CALL(mock_ffmpeg_, AVCodecOpen(&codec_context_, &codec_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVCodecOpen(&codec_context_, &codec_))
.WillOnce(Return(-1));
- EXPECT_CALL(mock_ffmpeg_, AVFree(&yuv_frame_))
+ EXPECT_CALL(*MockFFmpeg::get(), AVFree(&yuv_frame_))
.Times(1);
config_.codec = kCodecH264;
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698