OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "media/base/mock_ffmpeg.h" | 5 #include "media/base/mock_ffmpeg.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/ffmpeg/ffmpeg_common.h" | 8 #include "media/ffmpeg/ffmpeg_common.h" |
9 | 9 |
10 using ::testing::_; | 10 using ::testing::_; |
11 using ::testing::AtMost; | 11 using ::testing::AtMost; |
(...skipping 14 matching lines...) Expand all Loading... |
26 // | 26 // |
27 // TODO(scherkus): this feels gross and I need to think of a way to better | 27 // TODO(scherkus): this feels gross and I need to think of a way to better |
28 // inject/mock singletons. | 28 // inject/mock singletons. |
29 if (!protocol_) { | 29 if (!protocol_) { |
30 EXPECT_CALL(*this, AVLogSetLevel(AV_LOG_QUIET)) | 30 EXPECT_CALL(*this, AVLogSetLevel(AV_LOG_QUIET)) |
31 .Times(AtMost(1)) | 31 .Times(AtMost(1)) |
32 .WillOnce(Return()); | 32 .WillOnce(Return()); |
33 EXPECT_CALL(*this, AVCodecInit()) | 33 EXPECT_CALL(*this, AVCodecInit()) |
34 .Times(AtMost(1)) | 34 .Times(AtMost(1)) |
35 .WillOnce(Return()); | 35 .WillOnce(Return()); |
36 EXPECT_CALL(*this, AVRegisterProtocol2(_,_)) | 36 EXPECT_CALL(*this, AVRegisterProtocol(_)) |
37 .Times(AtMost(1)) | 37 .Times(AtMost(1)) |
38 .WillOnce(DoAll(SaveArg<0>(&protocol_), Return(0))); | 38 .WillOnce(DoAll(SaveArg<0>(&protocol_), Return(0))); |
39 EXPECT_CALL(*this, AVRegisterAll()) | 39 EXPECT_CALL(*this, AVRegisterAll()) |
40 .Times(AtMost(1)) | 40 .Times(AtMost(1)) |
41 .WillOnce(Return()); | 41 .WillOnce(Return()); |
42 } | 42 } |
43 // av_lockmgr_register() is also called from ~FFmpegLock(), so we expect | 43 // av_lockmgr_register() is also called from ~FFmpegLock(), so we expect |
44 // it to be called at the end. | 44 // it to be called at the end. |
45 EXPECT_CALL(*this, AVRegisterLockManager(_)) | 45 EXPECT_CALL(*this, AVRegisterLockManager(_)) |
46 .Times(AtMost(2)) | 46 .Times(AtMost(2)) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 packet->data = NULL; | 82 packet->data = NULL; |
83 packet->size = 0; | 83 packet->size = 0; |
84 } | 84 } |
85 | 85 |
86 // FFmpeg stubs that delegate to the FFmpegMock instance. | 86 // FFmpeg stubs that delegate to the FFmpegMock instance. |
87 extern "C" { | 87 extern "C" { |
88 void avcodec_init() { | 88 void avcodec_init() { |
89 media::MockFFmpeg::get()->AVCodecInit(); | 89 media::MockFFmpeg::get()->AVCodecInit(); |
90 } | 90 } |
91 | 91 |
92 int av_register_protocol2(URLProtocol* protocol, int size) { | 92 int av_register_protocol(URLProtocol* protocol) { |
93 return media::MockFFmpeg::get()->AVRegisterProtocol2(protocol, size); | 93 return media::MockFFmpeg::get()->AVRegisterProtocol(protocol); |
94 } | 94 } |
95 | 95 |
96 void av_register_all() { | 96 void av_register_all() { |
97 media::MockFFmpeg::get()->AVRegisterAll(); | 97 media::MockFFmpeg::get()->AVRegisterAll(); |
98 } | 98 } |
99 | 99 |
100 int av_lockmgr_register(int (*cb)(void**, enum AVLockOp)) { | 100 int av_lockmgr_register(int (*cb)(void**, enum AVLockOp)) { |
101 media::MockFFmpeg* mock = media::MockFFmpeg::get(); | 101 media::MockFFmpeg* mock = media::MockFFmpeg::get(); |
102 // Here |mock| may be NULL when this function is called from ~FFmpegGlue(). | 102 // Here |mock| may be NULL when this function is called from ~FFmpegGlue(). |
103 if (mock != NULL) { | 103 if (mock != NULL) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 media::MockFFmpeg::get()->AVLogSetLevel(level); | 220 media::MockFFmpeg::get()->AVLogSetLevel(level); |
221 } | 221 } |
222 | 222 |
223 void av_destruct_packet(AVPacket *pkt) { | 223 void av_destruct_packet(AVPacket *pkt) { |
224 media::MockFFmpeg::get()->AVDestructPacket(pkt); | 224 media::MockFFmpeg::get()->AVDestructPacket(pkt); |
225 } | 225 } |
226 | 226 |
227 } // extern "C" | 227 } // extern "C" |
228 | 228 |
229 } // namespace media | 229 } // namespace media |
OLD | NEW |