OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A new breed of mock media filters, this time using gmock! Feel free to add | 5 // A new breed of mock media filters, this time using gmock! Feel free to add |
6 // actions if you need interesting side-effects. | 6 // actions if you need interesting side-effects. |
7 // | 7 // |
8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock | 8 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock |
9 // filters to fail the test or do nothing when an unexpected method is called. | 9 // filters to fail the test or do nothing when an unexpected method is called. |
10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks | 10 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 int init_data_length, | 202 int init_data_length, |
203 const std::string& session_id)); | 203 const std::string& session_id)); |
204 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, | 204 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, |
205 const std::string& session_id)); | 205 const std::string& session_id)); |
206 MOCK_METHOD2(RegisterNewKeyCB, void(StreamType stream_type, | 206 MOCK_METHOD2(RegisterNewKeyCB, void(StreamType stream_type, |
207 const NewKeyCB& new_key_cb)); | 207 const NewKeyCB& new_key_cb)); |
208 MOCK_METHOD3(Decrypt, void(StreamType stream_type, | 208 MOCK_METHOD3(Decrypt, void(StreamType stream_type, |
209 const scoped_refptr<DecoderBuffer>& encrypted, | 209 const scoped_refptr<DecoderBuffer>& encrypted, |
210 const DecryptCB& decrypt_cb)); | 210 const DecryptCB& decrypt_cb)); |
211 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type)); | 211 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type)); |
212 // TODO(xhwang): The following method is a workaround of the issue that | 212 MOCK_METHOD2(InitializeAudioDecoder, |
213 // move-only parameters are not supported in mocked methods. Remove when the | |
214 // issue is fixed: http://code.google.com/p/googletest/issues/detail?id=395 | |
215 MOCK_METHOD2(InitializeAudioDecoderMock, | |
216 void(const AudioDecoderConfig& config, | 213 void(const AudioDecoderConfig& config, |
217 const DecoderInitCB& init_cb)); | 214 const DecoderInitCB& init_cb)); |
218 MOCK_METHOD2(InitializeVideoDecoder, | 215 MOCK_METHOD2(InitializeVideoDecoder, |
219 void(const VideoDecoderConfig& config, | 216 void(const VideoDecoderConfig& config, |
220 const DecoderInitCB& init_cb)); | 217 const DecoderInitCB& init_cb)); |
221 MOCK_METHOD2(DecryptAndDecodeAudio, | 218 MOCK_METHOD2(DecryptAndDecodeAudio, |
222 void(const scoped_refptr<media::DecoderBuffer>& encrypted, | 219 void(const scoped_refptr<media::DecoderBuffer>& encrypted, |
223 const AudioDecodeCB& audio_decode_cb)); | 220 const AudioDecodeCB& audio_decode_cb)); |
224 MOCK_METHOD2(DecryptAndDecodeVideo, | 221 MOCK_METHOD2(DecryptAndDecodeVideo, |
225 void(const scoped_refptr<media::DecoderBuffer>& encrypted, | 222 void(const scoped_refptr<media::DecoderBuffer>& encrypted, |
226 const VideoDecodeCB& video_decode_cb)); | 223 const VideoDecodeCB& video_decode_cb)); |
227 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type)); | 224 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type)); |
228 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type)); | 225 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type)); |
229 | 226 |
230 virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, | |
231 const DecoderInitCB& init_cb) OVERRIDE; | |
232 | |
233 private: | 227 private: |
234 DISALLOW_COPY_AND_ASSIGN(MockDecryptor); | 228 DISALLOW_COPY_AND_ASSIGN(MockDecryptor); |
235 }; | 229 }; |
236 | 230 |
237 // Helper mock statistics callback. | 231 // Helper mock statistics callback. |
238 class MockStatisticsCB { | 232 class MockStatisticsCB { |
239 public: | 233 public: |
240 MockStatisticsCB(); | 234 MockStatisticsCB(); |
241 ~MockStatisticsCB(); | 235 ~MockStatisticsCB(); |
242 | 236 |
243 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 237 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
244 }; | 238 }; |
245 | 239 |
246 } // namespace media | 240 } // namespace media |
247 | 241 |
248 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 242 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |