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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 protected: | 127 protected: |
128 virtual ~MockAudioDecoder(); | 128 virtual ~MockAudioDecoder(); |
129 | 129 |
130 private: | 130 private: |
131 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); | 131 DISALLOW_COPY_AND_ASSIGN(MockAudioDecoder); |
132 }; | 132 }; |
133 | 133 |
134 class MockVideoRenderer : public VideoRenderer { | 134 class MockVideoRenderer : public VideoRenderer { |
135 public: | 135 public: |
136 MockVideoRenderer(); | 136 MockVideoRenderer(); |
137 virtual ~MockVideoRenderer(); | |
138 | 137 |
139 // VideoRenderer implementation. | 138 // VideoRenderer implementation. |
140 MOCK_METHOD10(Initialize, void(const scoped_refptr<DemuxerStream>& stream, | 139 MOCK_METHOD10(Initialize, void(const scoped_refptr<DemuxerStream>& stream, |
141 const VideoDecoderList& decoders, | 140 const VideoDecoderList& decoders, |
142 const PipelineStatusCB& init_cb, | 141 const PipelineStatusCB& init_cb, |
143 const StatisticsCB& statistics_cb, | 142 const StatisticsCB& statistics_cb, |
144 const TimeCB& time_cb, | 143 const TimeCB& time_cb, |
145 const NaturalSizeChangedCB& size_changed_cb, | 144 const NaturalSizeChangedCB& size_changed_cb, |
146 const base::Closure& ended_cb, | 145 const base::Closure& ended_cb, |
147 const PipelineStatusCB& error_cb, | 146 const PipelineStatusCB& error_cb, |
148 const TimeDeltaCB& get_time_cb, | 147 const TimeDeltaCB& get_time_cb, |
149 const TimeDeltaCB& get_duration_cb)); | 148 const TimeDeltaCB& get_duration_cb)); |
150 MOCK_METHOD1(Play, void(const base::Closure& callback)); | 149 MOCK_METHOD1(Play, void(const base::Closure& callback)); |
151 MOCK_METHOD1(Pause, void(const base::Closure& callback)); | 150 MOCK_METHOD1(Pause, void(const base::Closure& callback)); |
152 MOCK_METHOD1(Flush, void(const base::Closure& callback)); | 151 MOCK_METHOD1(Flush, void(const base::Closure& callback)); |
153 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); | 152 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); |
154 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 153 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
155 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 154 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
156 | 155 |
| 156 protected: |
| 157 virtual ~MockVideoRenderer(); |
| 158 |
157 private: | 159 private: |
158 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); | 160 DISALLOW_COPY_AND_ASSIGN(MockVideoRenderer); |
159 }; | 161 }; |
160 | 162 |
161 class MockAudioRenderer : public AudioRenderer { | 163 class MockAudioRenderer : public AudioRenderer { |
162 public: | 164 public: |
163 MockAudioRenderer(); | 165 MockAudioRenderer(); |
164 virtual ~MockAudioRenderer(); | |
165 | 166 |
166 // AudioRenderer implementation. | 167 // AudioRenderer implementation. |
167 MOCK_METHOD9(Initialize, void(const scoped_refptr<DemuxerStream>& stream, | 168 MOCK_METHOD9(Initialize, void(const scoped_refptr<DemuxerStream>& stream, |
168 const AudioDecoderList& decoders, | 169 const AudioDecoderList& decoders, |
169 const PipelineStatusCB& init_cb, | 170 const PipelineStatusCB& init_cb, |
170 const StatisticsCB& statistics_cb, | 171 const StatisticsCB& statistics_cb, |
171 const base::Closure& underflow_cb, | 172 const base::Closure& underflow_cb, |
172 const TimeCB& time_cb, | 173 const TimeCB& time_cb, |
173 const base::Closure& ended_cb, | 174 const base::Closure& ended_cb, |
174 const base::Closure& disabled_cb, | 175 const base::Closure& disabled_cb, |
175 const PipelineStatusCB& error_cb)); | 176 const PipelineStatusCB& error_cb)); |
176 MOCK_METHOD1(Play, void(const base::Closure& callback)); | 177 MOCK_METHOD1(Play, void(const base::Closure& callback)); |
177 MOCK_METHOD1(Pause, void(const base::Closure& callback)); | 178 MOCK_METHOD1(Pause, void(const base::Closure& callback)); |
178 MOCK_METHOD1(Flush, void(const base::Closure& callback)); | 179 MOCK_METHOD1(Flush, void(const base::Closure& callback)); |
179 MOCK_METHOD1(Stop, void(const base::Closure& callback)); | 180 MOCK_METHOD1(Stop, void(const base::Closure& callback)); |
180 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 181 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
181 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); | 182 MOCK_METHOD2(Preroll, void(base::TimeDelta time, const PipelineStatusCB& cb)); |
182 MOCK_METHOD1(SetVolume, void(float volume)); | 183 MOCK_METHOD1(SetVolume, void(float volume)); |
183 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); | 184 MOCK_METHOD1(ResumeAfterUnderflow, void(bool buffer_more_audio)); |
184 | 185 |
| 186 protected: |
| 187 virtual ~MockAudioRenderer(); |
| 188 |
185 private: | 189 private: |
186 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); | 190 DISALLOW_COPY_AND_ASSIGN(MockAudioRenderer); |
187 }; | 191 }; |
188 | 192 |
189 class MockDecryptor : public Decryptor { | 193 class MockDecryptor : public Decryptor { |
190 public: | 194 public: |
191 MockDecryptor(); | 195 MockDecryptor(); |
192 virtual ~MockDecryptor(); | 196 virtual ~MockDecryptor(); |
193 | 197 |
194 MOCK_METHOD4(GenerateKeyRequest, bool(const std::string& key_system, | 198 MOCK_METHOD4(GenerateKeyRequest, bool(const std::string& key_system, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 public: | 245 public: |
242 MockStatisticsCB(); | 246 MockStatisticsCB(); |
243 ~MockStatisticsCB(); | 247 ~MockStatisticsCB(); |
244 | 248 |
245 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 249 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
246 }; | 250 }; |
247 | 251 |
248 } // namespace media | 252 } // namespace media |
249 | 253 |
250 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 254 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
OLD | NEW |