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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const uint8* init_data, | 198 const uint8* init_data, |
199 int init_data_length)); | 199 int init_data_length)); |
200 MOCK_METHOD6(AddKey, void(const std::string& key_system, | 200 MOCK_METHOD6(AddKey, void(const std::string& key_system, |
201 const uint8* key, | 201 const uint8* key, |
202 int key_length, | 202 int key_length, |
203 const uint8* init_data, | 203 const uint8* init_data, |
204 int init_data_length, | 204 int init_data_length, |
205 const std::string& session_id)); | 205 const std::string& session_id)); |
206 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, | 206 MOCK_METHOD2(CancelKeyRequest, void(const std::string& key_system, |
207 const std::string& session_id)); | 207 const std::string& session_id)); |
208 MOCK_METHOD2(Decrypt, void(const scoped_refptr<DecoderBuffer>& encrypted, | 208 MOCK_METHOD3(Decrypt, void(StreamType stream_type, |
| 209 const scoped_refptr<DecoderBuffer>& encrypted, |
209 const DecryptCB& decrypt_cb)); | 210 const DecryptCB& decrypt_cb)); |
210 MOCK_METHOD0(CancelDecrypt, void()); | 211 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type)); |
211 // TODO(xhwang): This is a workaround of the issue that move-only parameters | 212 // TODO(xhwang): The following two methods are workarounds of the issue that |
212 // are not supported in mocked methods. Remove this when the issue is fixed | 213 // move-only parameters are not supported in mocked methods. Remove when the |
213 // (http://code.google.com/p/googletest/issues/detail?id=395). | 214 // issue is fixed: http://code.google.com/p/googletest/issues/detail?id=395 |
| 215 MOCK_METHOD3(InitializeAudioDecoderMock, |
| 216 void(const AudioDecoderConfig& config, |
| 217 const DecoderInitCB& init_cb, |
| 218 const KeyAddedCB& key_added_cb)); |
214 MOCK_METHOD3(InitializeVideoDecoderMock, | 219 MOCK_METHOD3(InitializeVideoDecoderMock, |
215 void(const VideoDecoderConfig& config, | 220 void(const VideoDecoderConfig& config, |
216 const DecoderInitCB& init_cb, | 221 const DecoderInitCB& init_cb, |
217 const KeyAddedCB& key_added_cb)); | 222 const KeyAddedCB& key_added_cb)); |
| 223 MOCK_METHOD2(DecryptAndDecodeAudio, |
| 224 void(const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 225 const AudioDecodeCB& audio_decode_cb)); |
218 MOCK_METHOD2(DecryptAndDecodeVideo, | 226 MOCK_METHOD2(DecryptAndDecodeVideo, |
219 void(const scoped_refptr<media::DecoderBuffer>& encrypted, | 227 void(const scoped_refptr<media::DecoderBuffer>& encrypted, |
220 const VideoDecodeCB& video_decode_cb)); | 228 const VideoDecodeCB& video_decode_cb)); |
221 MOCK_METHOD0(CancelDecryptAndDecodeVideo, void()); | 229 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type)); |
222 MOCK_METHOD0(StopVideoDecoder, void()); | 230 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type)); |
223 | 231 |
| 232 virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, |
| 233 const DecoderInitCB& init_cb, |
| 234 const KeyAddedCB& key_added_cb) OVERRIDE; |
224 virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, | 235 virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, |
225 const DecoderInitCB& init_cb, | 236 const DecoderInitCB& init_cb, |
226 const KeyAddedCB& key_added_cb) OVERRIDE; | 237 const KeyAddedCB& key_added_cb) OVERRIDE; |
227 | 238 |
228 private: | 239 private: |
229 DISALLOW_COPY_AND_ASSIGN(MockDecryptor); | 240 DISALLOW_COPY_AND_ASSIGN(MockDecryptor); |
230 }; | 241 }; |
231 | 242 |
232 class MockDecryptorClient : public DecryptorClient { | 243 class MockDecryptorClient : public DecryptorClient { |
233 public: | 244 public: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 public: | 311 public: |
301 MockStatisticsCB(); | 312 MockStatisticsCB(); |
302 ~MockStatisticsCB(); | 313 ~MockStatisticsCB(); |
303 | 314 |
304 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 315 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
305 }; | 316 }; |
306 | 317 |
307 } // namespace media | 318 } // namespace media |
308 | 319 |
309 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 320 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |