| 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. |
| 11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks | 11 // http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks |
| 12 | 12 |
| 13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ | 13 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ |
| 14 #define MEDIA_BASE_MOCK_FILTERS_H_ | 14 #define MEDIA_BASE_MOCK_FILTERS_H_ |
| 15 | 15 |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "media/base/audio_decoder_config.h" |
| 18 #include "media/base/demuxer.h" | 19 #include "media/base/demuxer.h" |
| 19 #include "media/base/filters.h" | 20 #include "media/base/filters.h" |
| 20 #include "media/base/filter_collection.h" | 21 #include "media/base/filter_collection.h" |
| 21 #include "media/base/pipeline.h" | 22 #include "media/base/pipeline.h" |
| 22 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| 26 | 27 |
| 27 // Use this template to test for object destruction by setting expectations on | 28 // Use this template to test for object destruction by setting expectations on |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 class MockDemuxerStream : public DemuxerStream { | 156 class MockDemuxerStream : public DemuxerStream { |
| 156 public: | 157 public: |
| 157 MockDemuxerStream(); | 158 MockDemuxerStream(); |
| 158 | 159 |
| 159 // DemuxerStream implementation. | 160 // DemuxerStream implementation. |
| 160 MOCK_METHOD0(type, Type()); | 161 MOCK_METHOD0(type, Type()); |
| 161 MOCK_METHOD1(Read, void(const ReadCallback& read_callback)); | 162 MOCK_METHOD1(Read, void(const ReadCallback& read_callback)); |
| 162 MOCK_METHOD0(GetAVStream, AVStream*()); | 163 MOCK_METHOD0(GetAVStream, AVStream*()); |
| 164 MOCK_METHOD0(audio_decoder_config, const AudioDecoderConfig&()); |
| 163 MOCK_METHOD0(EnableBitstreamConverter, void()); | 165 MOCK_METHOD0(EnableBitstreamConverter, void()); |
| 164 | 166 |
| 165 protected: | 167 protected: |
| 166 virtual ~MockDemuxerStream(); | 168 virtual ~MockDemuxerStream(); |
| 167 | 169 |
| 168 private: | 170 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream); | 171 DISALLOW_COPY_AND_ASSIGN(MockDemuxerStream); |
| 170 }; | 172 }; |
| 171 | 173 |
| 172 class MockVideoDecoder : public VideoDecoder { | 174 class MockVideoDecoder : public VideoDecoder { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 public: | 354 public: |
| 353 MockStatisticsCallback(); | 355 MockStatisticsCallback(); |
| 354 ~MockStatisticsCallback(); | 356 ~MockStatisticsCallback(); |
| 355 | 357 |
| 356 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); | 358 MOCK_METHOD1(OnStatistics, void(const media::PipelineStatistics& statistics)); |
| 357 }; | 359 }; |
| 358 | 360 |
| 359 } // namespace media | 361 } // namespace media |
| 360 | 362 |
| 361 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 363 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |