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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const base::Closure& ended_cb, | 145 const base::Closure& ended_cb, |
146 const PipelineStatusCB& error_cb, | 146 const PipelineStatusCB& error_cb, |
147 const TimeDeltaCB& get_time_cb, | 147 const TimeDeltaCB& get_time_cb, |
148 const TimeDeltaCB& get_duration_cb)); | 148 const TimeDeltaCB& get_duration_cb)); |
149 MOCK_METHOD1(Play, void(const base::Closure& callback)); | 149 MOCK_METHOD1(Play, void(const base::Closure& callback)); |
150 MOCK_METHOD1(Pause, void(const base::Closure& callback)); | 150 MOCK_METHOD1(Pause, void(const base::Closure& callback)); |
151 MOCK_METHOD1(Flush, void(const base::Closure& callback)); | 151 MOCK_METHOD1(Flush, void(const base::Closure& callback)); |
152 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); | 152 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); |
153 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 153 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
154 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 154 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
155 MOCK_METHOD0(HasEnded, bool()); | |
156 | 155 |
157 protected: | 156 protected: |
158 virtual ~MockVideoRenderer(); | 157 virtual ~MockVideoRenderer(); |
159 | 158 |
160 private: | 159 private: |
161 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); | 160 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); |
162 }; | 161 }; |
163 | 162 |
164 class MockAudioRenderer : public AudioRenderer { | 163 class MockAudioRenderer : public AudioRenderer { |
165 public: | 164 public: |
166 MockAudioRenderer(); | 165 MockAudioRenderer(); |
167 | 166 |
168 // AudioRenderer implementation. | 167 // AudioRenderer implementation. |
169 MOCK_METHOD7(Initialize, void(const scoped_refptr<AudioDecoder>& decoder, | 168 MOCK_METHOD7(Initialize, void(const scoped_refptr<AudioDecoder>& decoder, |
170 const PipelineStatusCB& init_cb, | 169 const PipelineStatusCB& init_cb, |
171 const base::Closure& underflow_cb, | 170 const base::Closure& underflow_cb, |
172 const TimeCB& time_cb, | 171 const TimeCB& time_cb, |
173 const base::Closure& ended_cb, | 172 const base::Closure& ended_cb, |
174 const base::Closure& disabled_cb, | 173 const base::Closure& disabled_cb, |
175 const PipelineStatusCB& error_cb)); | 174 const PipelineStatusCB& error_cb)); |
176 MOCK_METHOD1(Play, void(const base::Closure& callback)); | 175 MOCK_METHOD1(Play, void(const base::Closure& callback)); |
177 MOCK_METHOD1(Pause, void(const base::Closure& callback)); | 176 MOCK_METHOD1(Pause, void(const base::Closure& callback)); |
178 MOCK_METHOD1(Flush, void(const base::Closure& callback)); | 177 MOCK_METHOD1(Flush, void(const base::Closure& callback)); |
179 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 178 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
180 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 179 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
181 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); | 180 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); |
182 MOCK_METHOD0(HasEnded, bool()); | |
183 MOCK_METHOD1(SetVolume, void(float volume)); | 181 MOCK_METHOD1(SetVolume, void(float volume)); |
184 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); | 182 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); |
185 | 183 |
186 protected: | 184 protected: |
187 virtual ~MockAudioRenderer(); | 185 virtual ~MockAudioRenderer(); |
188 | 186 |
189 private: | 187 private: |
190 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); | 188 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); |
191 }; | 189 }; |
192 | 190 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 public: | 288 public: |
291 MockStatisticsCB(); | 289 MockStatisticsCB(); |
292 ~MockStatisticsCB(); | 290 ~MockStatisticsCB(); |
293 | 291 |
294 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 292 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
295 }; | 293 }; |
296 | 294 |
297 } // namespace media | 295 } // namespace media |
298 | 296 |
299 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 297 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |