| OLD | NEW |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 // Filter implementation. | 71 // Filter implementation. |
| 72 virtual void set_host(FilterHost* host); | 72 virtual void set_host(FilterHost* host); |
| 73 | 73 |
| 74 MOCK_METHOD1(Stop, void(FilterCallback* callback)); | 74 MOCK_METHOD1(Stop, void(FilterCallback* callback)); |
| 75 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 75 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
| 76 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); | 76 MOCK_METHOD2(Seek, void(base::TimeDelta time, const FilterStatusCB& cb)); |
| 77 MOCK_METHOD0(OnAudioRendererDisabled, void()); | 77 MOCK_METHOD0(OnAudioRendererDisabled, void()); |
| 78 | 78 |
| 79 // DataSource implementation. | 79 // DataSource implementation. |
| 80 MOCK_METHOD0(media_format, const MediaFormat&()); | |
| 81 MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data, | 80 MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data, |
| 82 DataSource::ReadCallback* callback)); | 81 DataSource::ReadCallback* callback)); |
| 83 MOCK_METHOD1(GetSize, bool(int64* size_out)); | 82 MOCK_METHOD1(GetSize, bool(int64* size_out)); |
| 84 MOCK_METHOD1(SetPreload, void(Preload preload)); | 83 MOCK_METHOD1(SetPreload, void(Preload preload)); |
| 85 MOCK_METHOD0(IsStreaming, bool()); | 84 MOCK_METHOD0(IsStreaming, bool()); |
| 86 | 85 |
| 87 // Sets the TotalBytes & BufferedBytes values to be sent to host() when | 86 // Sets the TotalBytes & BufferedBytes values to be sent to host() when |
| 88 // the set_host() is called. | 87 // the set_host() is called. |
| 89 void SetTotalAndBufferedBytes(int64 total_bytes, int64 buffered_bytes); | 88 void SetTotalAndBufferedBytes(int64 total_bytes, int64 buffered_bytes); |
| 90 | 89 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 149 |
| 151 DISALLOW_COPY_AND_ASSIGN(MockDemuxerFactory); | 150 DISALLOW_COPY_AND_ASSIGN(MockDemuxerFactory); |
| 152 }; | 151 }; |
| 153 | 152 |
| 154 class MockDemuxerStream : public DemuxerStream { | 153 class MockDemuxerStream : public DemuxerStream { |
| 155 public: | 154 public: |
| 156 MockDemuxerStream(); | 155 MockDemuxerStream(); |
| 157 | 156 |
| 158 // DemuxerStream implementation. | 157 // DemuxerStream implementation. |
| 159 MOCK_METHOD0(type, Type()); | 158 MOCK_METHOD0(type, Type()); |
| 160 MOCK_METHOD0(media_format, const MediaFormat&()); | |
| 161 MOCK_METHOD1(Read, void(const ReadCallback& read_callback)); | 159 MOCK_METHOD1(Read, void(const ReadCallback& read_callback)); |
| 162 MOCK_METHOD0(GetAVStream, AVStream*()); | 160 MOCK_METHOD0(GetAVStream, AVStream*()); |
| 163 MOCK_METHOD0(EnableBitstreamConverter, void()); | 161 MOCK_METHOD0(EnableBitstreamConverter, void()); |
| 164 | 162 |
| 165 protected: | 163 protected: |
| 166 virtual ~MockDemuxerStream(); | 164 virtual ~MockDemuxerStream(); |
| 167 | 165 |
| 168 private: | 166 private: |
| 169 MediaFormat media_format_; | |
| 170 | |
| 171 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream); | 167 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream); |
| 172 }; | 168 }; |
| 173 | 169 |
| 174 class MockVideoDecoder : public VideoDecoder { | 170 class MockVideoDecoder : public VideoDecoder { |
| 175 public: | 171 public: |
| 176 MockVideoDecoder(); | 172 MockVideoDecoder(); |
| 177 | 173 |
| 178 // Filter implementation. | 174 // Filter implementation. |
| 179 MOCK_METHOD1(Stop, void(FilterCallback* callback)); | 175 MOCK_METHOD1(Stop, void(FilterCallback* callback)); |
| 180 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 176 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 public: | 350 public: |
| 355 MockStatisticsCallback(); | 351 MockStatisticsCallback(); |
| 356 ~MockStatisticsCallback(); | 352 ~MockStatisticsCallback(); |
| 357 | 353 |
| 358 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 354 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
| 359 }; | 355 }; |
| 360 | 356 |
| 361 } // namespace media | 357 } // namespace media |
| 362 | 358 |
| 363 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 359 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |