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

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

Issue 9015015: Take advantage of the new Pass() machinery on scoped_ptr{,_malloc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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
« no previous file with comments | « media/base/media_log.cc ('k') | media/base/mock_filters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 (i.e., copying data to the 6 // actions if you need interesting side-effects (i.e., copying data to the
7 // buffer passed into MockDataSource::Read()). 7 // buffer passed into MockDataSource::Read()).
8 // 8 //
9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock 9 // Don't forget you can use StrictMock<> and NiceMock<> if you want the mock
10 // filters to fail the test or do nothing when an unexpected method is called. 10 // filters to fail the test or do nothing when an unexpected method is called.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 public: 141 public:
142 explicit MockDemuxerFactory(MockDemuxer* demuxer); 142 explicit MockDemuxerFactory(MockDemuxer* demuxer);
143 virtual ~MockDemuxerFactory(); 143 virtual ~MockDemuxerFactory();
144 144
145 void SetError(PipelineStatus error); 145 void SetError(PipelineStatus error);
146 void RunBuildCallback(const std::string& url, const BuildCallback& callback); 146 void RunBuildCallback(const std::string& url, const BuildCallback& callback);
147 147
148 // DemuxerFactory methods. 148 // DemuxerFactory methods.
149 MOCK_METHOD2(Build, void(const std::string& url, 149 MOCK_METHOD2(Build, void(const std::string& url,
150 const BuildCallback& callback)); 150 const BuildCallback& callback));
151 virtual DemuxerFactory* Clone() const; 151 virtual scoped_ptr<DemuxerFactory> Clone() const;
152 152
153 private: 153 private:
154 scoped_refptr<MockDemuxer> demuxer_; 154 scoped_refptr<MockDemuxer> demuxer_;
155 PipelineStatus status_; 155 PipelineStatus status_;
156 156
157 DISALLOW_COPY_AND_ASSIGN(MockDemuxerFactory); 157 DISALLOW_COPY_AND_ASSIGN(MockDemuxerFactory);
158 }; 158 };
159 159
160 class MockDemuxerStream : public DemuxerStream { 160 class MockDemuxerStream : public DemuxerStream {
161 public: 161 public:
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 MockFilterCollection(); 287 MockFilterCollection();
288 virtual ~MockFilterCollection(); 288 virtual ~MockFilterCollection();
289 289
290 // Mock accessors. 290 // Mock accessors.
291 MockDemuxer* demuxer() const { return demuxer_; } 291 MockDemuxer* demuxer() const { return demuxer_; }
292 MockVideoDecoder* video_decoder() const { return video_decoder_; } 292 MockVideoDecoder* video_decoder() const { return video_decoder_; }
293 MockAudioDecoder* audio_decoder() const { return audio_decoder_; } 293 MockAudioDecoder* audio_decoder() const { return audio_decoder_; }
294 MockVideoRenderer* video_renderer() const { return video_renderer_; } 294 MockVideoRenderer* video_renderer() const { return video_renderer_; }
295 MockAudioRenderer* audio_renderer() const { return audio_renderer_; } 295 MockAudioRenderer* audio_renderer() const { return audio_renderer_; }
296 296
297 FilterCollection* filter_collection() const { 297 scoped_ptr<FilterCollection> filter_collection() const {
298 return filter_collection(true, true, true, PIPELINE_OK); 298 return filter_collection(true, true, true, PIPELINE_OK).Pass();
299 } 299 }
300 300
301 FilterCollection* filter_collection(bool include_demuxer, 301 scoped_ptr<FilterCollection> filter_collection(
302 bool run_build_callback, 302 bool include_demuxer, bool run_build_callback, bool run_build,
303 bool run_build, 303 PipelineStatus build_status) const;
304 PipelineStatus build_status) const;
305 304
306 private: 305 private:
307 scoped_refptr<MockDemuxer> demuxer_; 306 scoped_refptr<MockDemuxer> demuxer_;
308 scoped_refptr<MockVideoDecoder> video_decoder_; 307 scoped_refptr<MockVideoDecoder> video_decoder_;
309 scoped_refptr<MockAudioDecoder> audio_decoder_; 308 scoped_refptr<MockAudioDecoder> audio_decoder_;
310 scoped_refptr<MockVideoRenderer> video_renderer_; 309 scoped_refptr<MockVideoRenderer> video_renderer_;
311 scoped_refptr<MockAudioRenderer> audio_renderer_; 310 scoped_refptr<MockAudioRenderer> audio_renderer_;
312 311
313 DISALLOW_COPY_AND_ASSIGN(MockFilterCollection); 312 DISALLOW_COPY_AND_ASSIGN(MockFilterCollection);
314 }; 313 };
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 public: 347 public:
349 MockStatisticsCallback(); 348 MockStatisticsCallback();
350 ~MockStatisticsCallback(); 349 ~MockStatisticsCallback();
351 350
352 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); 351 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics));
353 }; 352 };
354 353
355 } // namespace media 354 } // namespace media
356 355
357 #endif // MEDIA_BASE_MOCK_FILTERS_H_ 356 #endif // MEDIA_BASE_MOCK_FILTERS_H_
OLDNEW
« no previous file with comments | « media/base/media_log.cc ('k') | media/base/mock_filters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698