Shaka Packager SDK
mock_media_playlist.h
1 // Copyright 2016 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
8 #define PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
9 
10 #include <gmock/gmock.h>
11 
12 #include <packager/hls/base/media_playlist.h>
13 
14 namespace shaka {
15 namespace hls {
16 
18  public:
19  // The actual parameters to MediaPlaylist() (parent) constructor doesn't
20  // matter because the return value can be mocked.
21  MockMediaPlaylist(const std::string& file_name,
22  const std::string& name,
23  const std::string& group_id);
24  ~MockMediaPlaylist() override;
25 
26  MOCK_METHOD1(SetMediaInfo, bool(const MediaInfo& media_info));
27  MOCK_METHOD5(AddSegment,
28  void(const std::string& file_name,
29  int64_t start_time,
30  int64_t duration,
31  uint64_t start_byte_offset,
32  uint64_t size));
33  MOCK_METHOD3(AddKeyFrame,
34  void(int64_t timestamp,
35  uint64_t start_byte_offset,
36  uint64_t size));
37  MOCK_METHOD6(AddEncryptionInfo,
38  void(EncryptionMethod method,
39  const std::string& url,
40  const std::string& key_id,
41  const std::string& iv,
42  const std::string& key_format,
43  const std::string& key_format_versions));
44  MOCK_METHOD0(AddPlacementOpportunity, void());
45  MOCK_METHOD1(WriteToFile, bool(const std::filesystem::path& file_path));
46  MOCK_CONST_METHOD0(MaxBitrate, uint64_t());
47  MOCK_CONST_METHOD0(AvgBitrate, uint64_t());
48  MOCK_CONST_METHOD0(GetLongestSegmentDuration, double());
49  MOCK_METHOD1(SetTargetDuration, void(int32_t target_duration));
50  MOCK_CONST_METHOD0(GetNumChannels, int());
51  MOCK_CONST_METHOD0(GetEC3JocComplexity, int());
52  MOCK_CONST_METHOD0(GetAC4ImsFlag, bool());
53  MOCK_CONST_METHOD0(GetAC4CbiFlag, bool());
54  MOCK_CONST_METHOD2(GetDisplayResolution,
55  bool(uint32_t* width, uint32_t* height));
56  MOCK_CONST_METHOD0(GetFrameRate, double());
57 };
58 
59 } // namespace hls
60 } // namespace shaka
61 
62 #endif // PACKAGER_HLS_BASE_MOCK_MEDIA_PLAYLIST_H_
Methods are virtual for mocking.
virtual bool GetAC4ImsFlag() const
virtual void AddEncryptionInfo(EncryptionMethod method, const std::string &url, const std::string &key_id, const std::string &iv, const std::string &key_format, const std::string &key_format_versions)
virtual void AddKeyFrame(int64_t timestamp, uint64_t start_byte_offset, uint64_t size)
virtual double GetFrameRate() const
virtual uint64_t AvgBitrate() const
virtual bool GetDisplayResolution(uint32_t *width, uint32_t *height) const
virtual double GetLongestSegmentDuration() const
virtual int GetEC3JocComplexity() const
virtual uint64_t MaxBitrate() const
virtual int GetNumChannels() const
virtual bool WriteToFile(const std::filesystem::path &file_path)
virtual void AddPlacementOpportunity()
virtual bool SetMediaInfo(const MediaInfo &media_info)
virtual void SetTargetDuration(int32_t target_duration)
virtual bool GetAC4CbiFlag() const
virtual void AddSegment(const std::string &file_name, int64_t start_time, int64_t duration, uint64_t start_byte_offset, uint64_t size)
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66