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

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

Issue 10753021: Move AudioRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: docs Created 8 years, 5 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 | Annotate | Revision Log
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 virtual ~MockVideoRenderer(); 190 virtual ~MockVideoRenderer();
191 191
192 private: 192 private:
193 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); 193 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer);
194 }; 194 };
195 195
196 class MockAudioRenderer : public AudioRenderer { 196 class MockAudioRenderer : public AudioRenderer {
197 public: 197 public:
198 MockAudioRenderer(); 198 MockAudioRenderer();
199 199
200 // Filter implementation. 200 // AudioRenderer implementation.
201 MOCK_METHOD1(SetHost, void(FilterHost* host)); 201 MOCK_METHOD1(SetHost, void(AudioRendererHost* host));
202 MOCK_METHOD4(Initialize, void(const scoped_refptr<AudioDecoder>& decoder,
203 const PipelineStatusCB& init_cb,
204 const base::Closure& underflow_cb,
205 const TimeCB& time_cb));
202 MOCK_METHOD1(Play, void(const base::Closure& callback)); 206 MOCK_METHOD1(Play, void(const base::Closure& callback));
203 MOCK_METHOD1(Pause, void(const base::Closure& callback)); 207 MOCK_METHOD1(Pause, void(const base::Closure& callback));
204 MOCK_METHOD1(Flush, void(const base::Closure& callback)); 208 MOCK_METHOD1(Flush, void(const base::Closure& callback));
205 MOCK_METHOD1(Stop, void(const base::Closure& callback)); 209 MOCK_METHOD1(Stop, void(const base::Closure& callback));
206 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); 210 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate));
207 MOCK_METHOD2(Seek, void(base::TimeDelta time, const PipelineStatusCB& cb)); 211 MOCK_METHOD2(Seek, void(base::TimeDelta time, const PipelineStatusCB& cb));
208
209 // AudioRenderer implementation.
210 MOCK_METHOD4(Initialize, void(const scoped_refptr<AudioDecoder>& decoder,
211 const PipelineStatusCB& init_cb,
212 const base::Closure& underflow_cb,
213 const TimeCB& time_cb));
214 MOCK_METHOD0(HasEnded, bool()); 212 MOCK_METHOD0(HasEnded, bool());
215 MOCK_METHOD1(SetVolume, void(float volume)); 213 MOCK_METHOD1(SetVolume, void(float volume));
216
217 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); 214 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio));
218 215
219 protected: 216 protected:
220 virtual ~MockAudioRenderer(); 217 virtual ~MockAudioRenderer();
221 218
222 private: 219 private:
223 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); 220 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer);
224 }; 221 };
225 222
223 class MockAudioRendererHost : public AudioRendererHost {
224 public:
225 MockAudioRendererHost();
226
227 // AudioRendererHost implementation.
228 MOCK_METHOD0(AudioRendererEnded, void());
229 MOCK_METHOD0(AudioRendererDisabled, void());
230
231 protected:
232 virtual ~MockAudioRendererHost();
233
234 private:
235 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost);
236 };
237
226 class MockDecryptorClient : public DecryptorClient { 238 class MockDecryptorClient : public DecryptorClient {
227 public: 239 public:
228 MockDecryptorClient(); 240 MockDecryptorClient();
229 virtual ~MockDecryptorClient(); 241 virtual ~MockDecryptorClient();
230 242
231 MOCK_METHOD2(KeyAdded, void(const std::string&, const std::string&)); 243 MOCK_METHOD2(KeyAdded, void(const std::string&, const std::string&));
232 MOCK_METHOD4(KeyError, void(const std::string&, const std::string&, 244 MOCK_METHOD4(KeyError, void(const std::string&, const std::string&,
233 Decryptor::KeyError, int)); 245 Decryptor::KeyError, int));
234 // TODO(xhwang): This is a workaround of the issue that move-only parameters 246 // TODO(xhwang): This is a workaround of the issue that move-only parameters
235 // are not supported in mocked methods. Remove this when the issue is fixed 247 // are not supported in mocked methods. Remove this when the issue is fixed
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 public: 326 public:
315 MockStatisticsCB(); 327 MockStatisticsCB();
316 ~MockStatisticsCB(); 328 ~MockStatisticsCB();
317 329
318 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 330 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
319 }; 331 };
320 332
321 } // namespace media 333 } // namespace media
322 334
323 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 335 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698