Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
|
DaleCurtis
2017/04/20 21:40:25
Ditto. Probably all new files in this cl need this
xjz
2017/04/20 22:07:45
Done. Thanks for catching this.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_TEST_MOCK_MEDIA_SOURCE_H_ | |
| 6 #define MEDIA_TEST_MOCK_MEDIA_SOURCE_H_ | |
| 7 | |
| 8 #include "base/time/time.h" | |
| 9 #include "media/base/demuxer.h" | |
| 10 #include "media/base/pipeline_status.h" | |
| 11 #include "media/filters/chunk_demuxer.h" | |
| 12 #include "testing/gmock/include/gmock/gmock.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 // Indicates that the whole file should be appended. | |
| 17 extern const size_t kAppendWholeFile; | |
| 18 | |
| 19 // Helper class that emulates calls made on the ChunkDemuxer by the | |
| 20 // Media Source API. | |
| 21 class MockMediaSource { | |
| 22 public: | |
| 23 MockMediaSource(const std::string& filename, | |
| 24 const std::string& mimetype, | |
| 25 size_t initial_append_size); | |
| 26 ~MockMediaSource(); | |
| 27 | |
| 28 std::unique_ptr<Demuxer> GetDemuxer(); | |
| 29 void set_encrypted_media_init_data_cb( | |
| 30 const Demuxer::EncryptedMediaInitDataCB& encrypted_media_init_data_cb); | |
| 31 void set_demuxer_failure_cb(const PipelineStatusCB& demuxer_failure_cb); | |
| 32 void Seek(base::TimeDelta seek_time, | |
| 33 size_t new_position, | |
| 34 size_t seek_append_size); | |
| 35 void Seek(base::TimeDelta seek_time); | |
| 36 void AppendData(size_t size); | |
| 37 bool AppendAtTime(base::TimeDelta timestamp_offset, | |
| 38 const uint8_t* pData, | |
| 39 int size); | |
| 40 void AppendAtTimeWithWindow(base::TimeDelta timestamp_offset, | |
| 41 base::TimeDelta append_window_start, | |
| 42 base::TimeDelta append_window_end, | |
| 43 const uint8_t* pData, | |
| 44 int size); | |
| 45 void SetMemoryLimits(size_t limit_bytes); | |
| 46 void EvictCodedFrames(base::TimeDelta currentMediaTime, size_t newDataSize); | |
| 47 void RemoveRange(base::TimeDelta start, base::TimeDelta end); | |
| 48 void EndOfStream(); | |
| 49 void Shutdown(); | |
| 50 void DemuxerOpened(); | |
| 51 void DemuxerOpenedTask(); | |
| 52 ChunkDemuxer::Status AddId(); | |
| 53 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, | |
| 54 const std::vector<uint8_t>& init_data); | |
| 55 base::TimeDelta last_timestamp_offset() const; | |
| 56 void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks); | |
| 57 MOCK_METHOD1(InitSegmentReceivedMock, void(std::unique_ptr<MediaTracks>&)); | |
| 58 | |
| 59 private: | |
| 60 MediaLog media_log_; | |
| 61 scoped_refptr<DecoderBuffer> file_data_; | |
| 62 size_t current_position_; | |
| 63 size_t initial_append_size_; | |
| 64 std::string mimetype_; | |
| 65 ChunkDemuxer* chunk_demuxer_; | |
| 66 std::unique_ptr<Demuxer> owned_chunk_demuxer_; | |
| 67 PipelineStatusCB demuxer_failure_cb_; | |
| 68 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | |
| 69 base::TimeDelta last_timestamp_offset_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(MockMediaSource); | |
| 72 }; | |
| 73 | |
| 74 } // namespace media | |
| 75 | |
| 76 #endif // MEDIA_TEST_MOCK_MEDIA_SOURCE_H_ | |
| OLD | NEW |