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