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  private:
45  // Only for constructing the super class. Not used for testing.
46  base::AtomicSequenceNumber sequence_counter_;
47 };
48 
50  public:
51  // |representation_id| is the numeric ID for the <Representation>.
52  explicit MockRepresentation(uint32_t representation_id);
53  ~MockRepresentation() override;
54 
55  MOCK_METHOD1(AddContentProtectionElement,
56  void(const ContentProtectionElement& element));
57  MOCK_METHOD2(UpdateContentProtectionPssh,
58  void(const std::string& drm_uuid, const std::string& pssh));
59  MOCK_METHOD3(AddNewSegment,
60  void(uint64_t start_time, uint64_t duration, uint64_t size));
61  MOCK_METHOD1(SetSampleDuration, void(uint32_t sample_duration));
62 };
63 
64 } // namespace shaka
65 
66 #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:690
This class generates DASH MPDs (Media Presentation Descriptions).
Definition: mpd_builder.h:57
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
Definition: mpd_builder.cc:734
virtual void AddRole(Role role)
Definition: mpd_builder.cc:746
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
Definition: mpd_builder.cc:740
MpdType type() const
Definition: mpd_builder.h:92
virtual bool ToString(std::string *output)
Definition: mpd_builder.cc:429
virtual void ForceSetSegmentAlignment(bool segment_alignment)
Definition: mpd_builder.cc:843
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
Definition: mpd_builder.cc:410
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)