| 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 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ | 5 #ifndef MEDIA_BASE_MOCK_FILTERS_H_ |
| 6 #define MEDIA_BASE_MOCK_FILTERS_H_ | 6 #define MEDIA_BASE_MOCK_FILTERS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "media/base/audio_decoder.h" | 15 #include "media/base/audio_decoder.h" |
| 15 #include "media/base/audio_decoder_config.h" | 16 #include "media/base/audio_decoder_config.h" |
| 16 #include "media/base/audio_renderer.h" | 17 #include "media/base/audio_renderer.h" |
| 17 #include "media/base/cdm_context.h" | 18 #include "media/base/cdm_context.h" |
| 18 #include "media/base/decoder_buffer.h" | 19 #include "media/base/decoder_buffer.h" |
| 19 #include "media/base/decryptor.h" | 20 #include "media/base/decryptor.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 public: | 36 public: |
| 36 MockPipeline(); | 37 MockPipeline(); |
| 37 virtual ~MockPipeline(); | 38 virtual ~MockPipeline(); |
| 38 | 39 |
| 39 // Note: Start() and Resume() declarations are not actually overrides; they | 40 // Note: Start() and Resume() declarations are not actually overrides; they |
| 40 // take scoped_ptr* instead of scoped_ptr so that they can be mock methods. | 41 // take scoped_ptr* instead of scoped_ptr so that they can be mock methods. |
| 41 // Private stubs for Start() and Resume() implement the actual Pipeline | 42 // Private stubs for Start() and Resume() implement the actual Pipeline |
| 42 // interface by forwarding to these mock methods. | 43 // interface by forwarding to these mock methods. |
| 43 MOCK_METHOD10(Start, | 44 MOCK_METHOD10(Start, |
| 44 void(Demuxer*, | 45 void(Demuxer*, |
| 45 scoped_ptr<Renderer>*, | 46 std::unique_ptr<Renderer>*, |
| 46 const base::Closure&, | 47 const base::Closure&, |
| 47 const PipelineStatusCB&, | 48 const PipelineStatusCB&, |
| 48 const PipelineStatusCB&, | 49 const PipelineStatusCB&, |
| 49 const PipelineMetadataCB&, | 50 const PipelineMetadataCB&, |
| 50 const BufferingStateCB&, | 51 const BufferingStateCB&, |
| 51 const base::Closure&, | 52 const base::Closure&, |
| 52 const AddTextTrackCB&, | 53 const AddTextTrackCB&, |
| 53 const base::Closure&)); | 54 const base::Closure&)); |
| 54 MOCK_METHOD1(Stop, void(const base::Closure&)); | 55 MOCK_METHOD1(Stop, void(const base::Closure&)); |
| 55 MOCK_METHOD2(Seek, void(base::TimeDelta, const PipelineStatusCB&)); | 56 MOCK_METHOD2(Seek, void(base::TimeDelta, const PipelineStatusCB&)); |
| 56 MOCK_METHOD1(Suspend, void(const PipelineStatusCB&)); | 57 MOCK_METHOD1(Suspend, void(const PipelineStatusCB&)); |
| 57 MOCK_METHOD3(Resume, | 58 MOCK_METHOD3(Resume, |
| 58 void(scoped_ptr<Renderer>*, | 59 void(std::unique_ptr<Renderer>*, |
| 59 base::TimeDelta, | 60 base::TimeDelta, |
| 60 const PipelineStatusCB&)); | 61 const PipelineStatusCB&)); |
| 61 | 62 |
| 62 // TODO(sandersd): This should automatically return true between Start() and | 63 // TODO(sandersd): This should automatically return true between Start() and |
| 63 // Stop(). (Or better, remove it from the interface entirely.) | 64 // Stop(). (Or better, remove it from the interface entirely.) |
| 64 MOCK_CONST_METHOD0(IsRunning, bool()); | 65 MOCK_CONST_METHOD0(IsRunning, bool()); |
| 65 | 66 |
| 66 // TODO(sandersd): These should be regular getters/setters. | 67 // TODO(sandersd): These should be regular getters/setters. |
| 67 MOCK_CONST_METHOD0(GetPlaybackRate, double()); | 68 MOCK_CONST_METHOD0(GetPlaybackRate, double()); |
| 68 MOCK_METHOD1(SetPlaybackRate, void(double)); | 69 MOCK_METHOD1(SetPlaybackRate, void(double)); |
| 69 MOCK_CONST_METHOD0(GetVolume, float()); | 70 MOCK_CONST_METHOD0(GetVolume, float()); |
| 70 MOCK_METHOD1(SetVolume, void(float)); | 71 MOCK_METHOD1(SetVolume, void(float)); |
| 71 | 72 |
| 72 // TODO(sandersd): These should probably have setters too. | 73 // TODO(sandersd): These should probably have setters too. |
| 73 MOCK_CONST_METHOD0(GetMediaTime, base::TimeDelta()); | 74 MOCK_CONST_METHOD0(GetMediaTime, base::TimeDelta()); |
| 74 MOCK_CONST_METHOD0(GetBufferedTimeRanges, Ranges<base::TimeDelta>()); | 75 MOCK_CONST_METHOD0(GetBufferedTimeRanges, Ranges<base::TimeDelta>()); |
| 75 MOCK_CONST_METHOD0(GetMediaDuration, base::TimeDelta()); | 76 MOCK_CONST_METHOD0(GetMediaDuration, base::TimeDelta()); |
| 76 MOCK_METHOD0(DidLoadingProgress, bool()); | 77 MOCK_METHOD0(DidLoadingProgress, bool()); |
| 77 MOCK_CONST_METHOD0(GetStatistics, PipelineStatistics()); | 78 MOCK_CONST_METHOD0(GetStatistics, PipelineStatistics()); |
| 78 | 79 |
| 79 MOCK_METHOD2(SetCdm, void(CdmContext*, const CdmAttachedCB&)); | 80 MOCK_METHOD2(SetCdm, void(CdmContext*, const CdmAttachedCB&)); |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 // Forwarding stubs (see comment above). | 83 // Forwarding stubs (see comment above). |
| 83 void Start(Demuxer* demuxer, | 84 void Start(Demuxer* demuxer, |
| 84 scoped_ptr<Renderer> renderer, | 85 std::unique_ptr<Renderer> renderer, |
| 85 const base::Closure& ended_cb, | 86 const base::Closure& ended_cb, |
| 86 const PipelineStatusCB& error_cb, | 87 const PipelineStatusCB& error_cb, |
| 87 const PipelineStatusCB& seek_cb, | 88 const PipelineStatusCB& seek_cb, |
| 88 const PipelineMetadataCB& metadata_cb, | 89 const PipelineMetadataCB& metadata_cb, |
| 89 const BufferingStateCB& buffering_state_cb, | 90 const BufferingStateCB& buffering_state_cb, |
| 90 const base::Closure& duration_change_cb, | 91 const base::Closure& duration_change_cb, |
| 91 const AddTextTrackCB& add_text_track_cb, | 92 const AddTextTrackCB& add_text_track_cb, |
| 92 const base::Closure& waiting_for_decryption_key_cb) override; | 93 const base::Closure& waiting_for_decryption_key_cb) override; |
| 93 void Resume(scoped_ptr<Renderer> renderer, | 94 void Resume(std::unique_ptr<Renderer> renderer, |
| 94 base::TimeDelta timestamp, | 95 base::TimeDelta timestamp, |
| 95 const PipelineStatusCB& seek_cb) override; | 96 const PipelineStatusCB& seek_cb) override; |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(MockPipeline); | 98 DISALLOW_COPY_AND_ASSIGN(MockPipeline); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 class MockDemuxer : public Demuxer { | 101 class MockDemuxer : public Demuxer { |
| 101 public: | 102 public: |
| 102 MockDemuxer(); | 103 MockDemuxer(); |
| 103 virtual ~MockDemuxer(); | 104 virtual ~MockDemuxer(); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 MOCK_METHOD0(GetDecryptor, Decryptor*()); | 342 MOCK_METHOD0(GetDecryptor, Decryptor*()); |
| 342 int GetCdmId() const override; | 343 int GetCdmId() const override; |
| 343 | 344 |
| 344 private: | 345 private: |
| 345 DISALLOW_COPY_AND_ASSIGN(MockCdmContext); | 346 DISALLOW_COPY_AND_ASSIGN(MockCdmContext); |
| 346 }; | 347 }; |
| 347 | 348 |
| 348 } // namespace media | 349 } // namespace media |
| 349 | 350 |
| 350 #endif // MEDIA_BASE_MOCK_FILTERS_H_ | 351 #endif // MEDIA_BASE_MOCK_FILTERS_H_ |
| OLD | NEW |