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 <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "media/base/text_track.h" | 24 #include "media/base/text_track.h" |
25 #include "media/base/time_source.h" | 25 #include "media/base/time_source.h" |
26 #include "media/base/video_decoder.h" | 26 #include "media/base/video_decoder.h" |
27 #include "media/base/video_decoder_config.h" | 27 #include "media/base/video_decoder_config.h" |
28 #include "media/base/video_frame.h" | 28 #include "media/base/video_frame.h" |
29 #include "media/base/video_renderer.h" | 29 #include "media/base/video_renderer.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
31 | 31 |
32 namespace media { | 32 namespace media { |
33 | 33 |
| 34 class MockPipelineClient : public Pipeline::Client { |
| 35 public: |
| 36 MockPipelineClient(); |
| 37 ~MockPipelineClient() override; |
| 38 |
| 39 MOCK_METHOD1(OnError, void(PipelineStatus)); |
| 40 MOCK_METHOD0(OnEnded, void()); |
| 41 MOCK_METHOD1(OnMetadata, void(PipelineMetadata)); |
| 42 MOCK_METHOD1(OnBufferingStateChange, void(BufferingState)); |
| 43 MOCK_METHOD0(OnDurationChange, void()); |
| 44 MOCK_METHOD2(OnAddTextTrack, |
| 45 void(const TextTrackConfig&, const AddTextTrackDoneCB&)); |
| 46 MOCK_METHOD0(OnWaitingForDecryptionKey, void()); |
| 47 }; |
| 48 |
34 class MockPipeline : public Pipeline { | 49 class MockPipeline : public Pipeline { |
35 public: | 50 public: |
36 MockPipeline(); | 51 MockPipeline(); |
37 virtual ~MockPipeline(); | 52 virtual ~MockPipeline(); |
38 | 53 |
39 // Note: Start() and Resume() declarations are not actually overrides; they | 54 // 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. | 55 // 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 | 56 // Private stubs for Start() and Resume() implement the actual Pipeline |
42 // interface by forwarding to these mock methods. | 57 // interface by forwarding to these mock methods. |
43 MOCK_METHOD10(Start, | 58 MOCK_METHOD4( |
44 void(Demuxer*, | 59 Start, |
45 scoped_ptr<Renderer>*, | 60 void(Demuxer*, scoped_ptr<Renderer>*, Client*, const PipelineStatusCB&)); |
46 const base::Closure&, | |
47 const PipelineStatusCB&, | |
48 const PipelineStatusCB&, | |
49 const PipelineMetadataCB&, | |
50 const BufferingStateCB&, | |
51 const base::Closure&, | |
52 const AddTextTrackCB&, | |
53 const base::Closure&)); | |
54 MOCK_METHOD1(Stop, void(const base::Closure&)); | 61 MOCK_METHOD1(Stop, void(const base::Closure&)); |
55 MOCK_METHOD2(Seek, void(base::TimeDelta, const PipelineStatusCB&)); | 62 MOCK_METHOD2(Seek, void(base::TimeDelta, const PipelineStatusCB&)); |
56 MOCK_METHOD1(Suspend, void(const PipelineStatusCB&)); | 63 MOCK_METHOD1(Suspend, void(const PipelineStatusCB&)); |
57 MOCK_METHOD3(Resume, | 64 MOCK_METHOD3(Resume, |
58 void(scoped_ptr<Renderer>*, | 65 void(scoped_ptr<Renderer>*, |
59 base::TimeDelta, | 66 base::TimeDelta, |
60 const PipelineStatusCB&)); | 67 const PipelineStatusCB&)); |
61 | 68 |
62 // TODO(sandersd): This should automatically return true between Start() and | 69 // TODO(sandersd): This should automatically return true between Start() and |
63 // Stop(). (Or better, remove it from the interface entirely.) | 70 // Stop(). (Or better, remove it from the interface entirely.) |
(...skipping 11 matching lines...) Expand all Loading... |
75 MOCK_CONST_METHOD0(GetMediaDuration, base::TimeDelta()); | 82 MOCK_CONST_METHOD0(GetMediaDuration, base::TimeDelta()); |
76 MOCK_METHOD0(DidLoadingProgress, bool()); | 83 MOCK_METHOD0(DidLoadingProgress, bool()); |
77 MOCK_CONST_METHOD0(GetStatistics, PipelineStatistics()); | 84 MOCK_CONST_METHOD0(GetStatistics, PipelineStatistics()); |
78 | 85 |
79 MOCK_METHOD2(SetCdm, void(CdmContext*, const CdmAttachedCB&)); | 86 MOCK_METHOD2(SetCdm, void(CdmContext*, const CdmAttachedCB&)); |
80 | 87 |
81 private: | 88 private: |
82 // Forwarding stubs (see comment above). | 89 // Forwarding stubs (see comment above). |
83 void Start(Demuxer* demuxer, | 90 void Start(Demuxer* demuxer, |
84 scoped_ptr<Renderer> renderer, | 91 scoped_ptr<Renderer> renderer, |
85 const base::Closure& ended_cb, | 92 Client* client, |
86 const PipelineStatusCB& error_cb, | 93 const PipelineStatusCB& seek_cb) override; |
87 const PipelineStatusCB& seek_cb, | |
88 const PipelineMetadataCB& metadata_cb, | |
89 const BufferingStateCB& buffering_state_cb, | |
90 const base::Closure& duration_change_cb, | |
91 const AddTextTrackCB& add_text_track_cb, | |
92 const base::Closure& waiting_for_decryption_key_cb) override; | |
93 void Resume(scoped_ptr<Renderer> renderer, | 94 void Resume(scoped_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(); |
(...skipping 238 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 |