| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); | 95 MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); |
| 96 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); | 96 MOCK_METHOD2(Seek, void(base::TimeDelta time, FilterCallback* callback)); |
| 97 | 97 |
| 98 // DataSource implementation. | 98 // DataSource implementation. |
| 99 MOCK_METHOD2(Initialize, void(const std::string& url, | 99 MOCK_METHOD2(Initialize, void(const std::string& url, |
| 100 FilterCallback* callback)); | 100 FilterCallback* callback)); |
| 101 const MediaFormat& media_format() { return media_format_; } | 101 const MediaFormat& media_format() { return media_format_; } |
| 102 MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data, | 102 MOCK_METHOD4(Read, void(int64 position, size_t size, uint8* data, |
| 103 DataSource::ReadCallback* callback)); | 103 DataSource::ReadCallback* callback)); |
| 104 MOCK_METHOD1(GetSize, bool(int64* size_out)); | 104 MOCK_METHOD1(GetSize, bool(int64* size_out)); |
| 105 MOCK_METHOD0(IsSeekable, bool()); | 105 MOCK_METHOD0(IsStreaming, bool()); |
| 106 | 106 |
| 107 protected: | 107 protected: |
| 108 virtual ~MockDataSource() {} | 108 virtual ~MockDataSource() {} |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 MediaFormat media_format_; | 111 MediaFormat media_format_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(MockDataSource); | 113 DISALLOW_COPY_AND_ASSIGN(MockDataSource); |
| 114 }; | 114 }; |
| 115 | 115 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 // Helper gmock action that calls SetDuration() on behalf of the provided | 339 // Helper gmock action that calls SetDuration() on behalf of the provided |
| 340 // filter. | 340 // filter. |
| 341 ACTION_P2(SetDuration, filter, duration) { | 341 ACTION_P2(SetDuration, filter, duration) { |
| 342 filter->host()->SetDuration(duration); | 342 filter->host()->SetDuration(duration); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace media | 345 } // namespace media |
| 346 | 346 |
| 347 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 347 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |