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

Side by Side Diff: media/base/mock_filters.h

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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 unified diff | Download patch
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 MOCK_METHOD3(Decrypt, void(StreamType stream_type, 210 MOCK_METHOD3(Decrypt, void(StreamType stream_type,
211 const scoped_refptr<DecoderBuffer>& encrypted, 211 const scoped_refptr<DecoderBuffer>& encrypted,
212 const DecryptCB& decrypt_cb)); 212 const DecryptCB& decrypt_cb));
213 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type)); 213 MOCK_METHOD1(CancelDecrypt, void(StreamType stream_type));
214 // TODO(xhwang): The following two methods are workarounds of the issue that 214 // TODO(xhwang): The following two methods are workarounds of the issue that
215 // move-only parameters are not supported in mocked methods. Remove when the 215 // move-only parameters are not supported in mocked methods. Remove when the
216 // issue is fixed: 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, 217 MOCK_METHOD3(InitializeAudioDecoderMock,
218 void(const AudioDecoderConfig& config, 218 void(const AudioDecoderConfig& config,
219 const DecoderInitCB& init_cb, 219 const DecoderInitCB& init_cb,
220 const KeyAddedCB& key_added_cb)); 220 const OnKeyAddedCB& key_added_cb));
221 MOCK_METHOD3(InitializeVideoDecoderMock, 221 MOCK_METHOD3(InitializeVideoDecoderMock,
222 void(const VideoDecoderConfig& config, 222 void(const VideoDecoderConfig& config,
223 const DecoderInitCB& init_cb, 223 const DecoderInitCB& init_cb,
224 const KeyAddedCB& key_added_cb)); 224 const OnKeyAddedCB& key_added_cb));
225 MOCK_METHOD2(DecryptAndDecodeAudio, 225 MOCK_METHOD2(DecryptAndDecodeAudio,
226 void(const scoped_refptr<media::DecoderBuffer>& encrypted, 226 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
227 const AudioDecodeCB& audio_decode_cb)); 227 const AudioDecodeCB& audio_decode_cb));
228 MOCK_METHOD2(DecryptAndDecodeVideo, 228 MOCK_METHOD2(DecryptAndDecodeVideo,
229 void(const scoped_refptr<media::DecoderBuffer>& encrypted, 229 void(const scoped_refptr<media::DecoderBuffer>& encrypted,
230 const VideoDecodeCB& video_decode_cb)); 230 const VideoDecodeCB& video_decode_cb));
231 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type)); 231 MOCK_METHOD1(ResetDecoder, void(StreamType stream_type));
232 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type)); 232 MOCK_METHOD1(DeinitializeDecoder, void(StreamType stream_type));
233 233
234 virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, 234 virtual void InitializeAudioDecoder(
235 const DecoderInitCB& init_cb, 235 scoped_ptr<AudioDecoderConfig> config,
236 const KeyAddedCB& key_added_cb) OVERRIDE; 236 const DecoderInitCB& init_cb,
237 virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, 237 const OnKeyAddedCB& key_added_cb) OVERRIDE;
238 const DecoderInitCB& init_cb, 238 virtual void InitializeVideoDecoder(
239 const KeyAddedCB& key_added_cb) OVERRIDE; 239 scoped_ptr<VideoDecoderConfig> config,
240 const DecoderInitCB& init_cb,
241 const OnKeyAddedCB& key_added_cb) OVERRIDE;
240 242
241 private: 243 private:
242 DISALLOW_COPY_AND_ASSIGN(MockDecryptor); 244 DISALLOW_COPY_AND_ASSIGN(MockDecryptor);
243 }; 245 };
244 246
245 class MockDecryptorClient : public DecryptorClient { 247 class MockDecryptorClient : public DecryptorClient {
246 public: 248 public:
247 MockDecryptorClient(); 249 MockDecryptorClient();
248 virtual ~MockDecryptorClient(); 250 virtual ~MockDecryptorClient();
249 251
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 public: 315 public:
314 MockStatisticsCB(); 316 MockStatisticsCB();
315 ~MockStatisticsCB(); 317 ~MockStatisticsCB();
316 318
317 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 319 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
318 }; 320 };
319 321
320 } // namespace media 322 } // namespace media
321 323
322 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 324 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698