DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
mock_mpd_builder.h
1 // Copyright 2015 Google Inc. 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 MPD_BASE_MOCK_MPD_BUILDER_H_
8 #define MPD_BASE_MOCK_MPD_BUILDER_H_
9 
10 #include <gmock/gmock.h>
11 
12 #include "packager/base/compiler_specific.h"
13 #include "packager/base/synchronization/lock.h"
14 #include "packager/mpd/base/content_protection_element.h"
15 #include "packager/mpd/base/mpd_builder.h"
16 
17 namespace shaka {
18 
19 class MockMpdBuilder : public MpdBuilder {
20  public:
21  // |type| indicates whether the MPD should be for VOD or live content (kStatic
22  // for VOD profile, or kDynamic for live profile).
23  explicit MockMpdBuilder(MpdType type);
24  ~MockMpdBuilder() override;
25 
26  MOCK_METHOD1(AddAdaptationSet, AdaptationSet*(const std::string& lang));
27  MOCK_METHOD1(ToString, bool(std::string* output));
28 };
29 
31  public:
32  // |adaptation_set_id| is the id for the AdaptationSet.
33  explicit MockAdaptationSet(uint32_t adaptation_set_id);
34  ~MockAdaptationSet() override;
35 
36  MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
37  MOCK_METHOD1(AddContentProtectionElement,
38  void(const ContentProtectionElement& element));
39  MOCK_METHOD2(UpdateContentProtectionPssh,
40  void(const std::string& drm_uuid, const std::string& pssh));
41  MOCK_METHOD1(AddRole, void(AdaptationSet::Role role));
42  MOCK_METHOD1(ForceSetSegmentAlignment, void(bool segment_alignment));
43 
44  MOCK_METHOD1(SetGroup, void(int group_number));
45  MOCK_CONST_METHOD0(Group, int());
46 
47  private:
48  // Only for constructing the super class. Not used for testing.
49  base::AtomicSequenceNumber sequence_counter_;
50 };
51 
53  public:
54  // |representation_id| is the numeric ID for the <Representation>.
55  explicit MockRepresentation(uint32_t representation_id);
56  ~MockRepresentation() override;
57 
58  MOCK_METHOD1(AddContentProtectionElement,
59  void(const ContentProtectionElement& element));
60  MOCK_METHOD2(UpdateContentProtectionPssh,
61  void(const std::string& drm_uuid, const std::string& pssh));
62  MOCK_METHOD3(AddNewSegment,
63  void(uint64_t start_time, uint64_t duration, uint64_t size));
64  MOCK_METHOD1(SetSampleDuration, void(uint32_t sample_duration));
65 };
66 
67 } // namespace shaka
68 
69 #endif // MPD_BASE_MOCK_MPD_BUILDER_H_
virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
virtual void SetSampleDuration(uint32_t sample_duration)
virtual Representation * AddRepresentation(const MediaInfo &media_info)
Definition: mpd_builder.cc:689
This class generates DASH MPDs (Media Presentation Descriptions).
Definition: mpd_builder.h:57
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
Definition: mpd_builder.cc:733
virtual void AddRole(Role role)
Definition: mpd_builder.cc:745
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
Definition: mpd_builder.cc:739
MpdType type() const
Definition: mpd_builder.h:92
virtual void SetGroup(int group_number)
Definition: mpd_builder.cc:839
virtual bool ToString(std::string *output)
Definition: mpd_builder.cc:427
virtual void ForceSetSegmentAlignment(bool segment_alignment)
Definition: mpd_builder.cc:833
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
Definition: mpd_builder.cc:412
virtual int Group() const
Definition: mpd_builder.cc:843
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)