DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs 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/mpd/base/content_protection_element.h"
14 #include "packager/mpd/base/mpd_builder.h"
15 
16 namespace edash_packager {
17 
18 class MockMpdBuilder : public MpdBuilder {
19  public:
20  // |type| indicates whether the MPD should be for VOD or live content (kStatic
21  // for VOD profile, or kDynamic for live profile).
22  explicit MockMpdBuilder(MpdType type);
23  ~MockMpdBuilder() override;
24 
25  MOCK_METHOD1(AddAdaptationSet, AdaptationSet*(const std::string& lang));
26  MOCK_METHOD1(ToString, bool(std::string* output));
27 };
28 
30  public:
31  // |adaptation_set_id| is the id for the AdaptationSet.
32  explicit MockAdaptationSet(uint32_t adaptation_set_id);
33  ~MockAdaptationSet() override;
34 
35  MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
36  MOCK_METHOD1(AddContentProtectionElement,
37  void(const ContentProtectionElement& element));
38  MOCK_METHOD2(UpdateContentProtectionPssh,
39  void(const std::string& drm_uuid, const std::string& pssh));
40  MOCK_METHOD1(AddRole, void(AdaptationSet::Role role));
41  MOCK_METHOD1(ForceSetSegmentAlignment, void(bool segment_alignment));
42 
43  MOCK_METHOD1(SetGroup, void(int group_number));
44  MOCK_CONST_METHOD0(Group, int());
45 
46  private:
47  // Only for constructing the super class. Not used for testing.
48  base::AtomicSequenceNumber sequence_counter_;
49 };
50 
52  public:
53  // |representation_id| is the numeric ID for the <Representation>.
54  explicit MockRepresentation(uint32_t representation_id);
55  ~MockRepresentation() override;
56 
57  MOCK_METHOD1(AddContentProtectionElement,
58  void(const ContentProtectionElement& element));
59  MOCK_METHOD2(UpdateContentProtectionPssh,
60  void(const std::string& drm_uuid, const std::string& pssh));
61  MOCK_METHOD3(AddNewSegment,
62  void(uint64_t start_time, uint64_t duration, uint64_t size));
63  MOCK_METHOD1(SetSampleDuration, void(uint32_t sample_duration));
64 };
65 
66 } // namespace edash_packager
67 
68 #endif // MPD_BASE_MOCK_MPD_BUILDER_H_
MpdType type() const
Definition: mpd_builder.h:91
virtual void AddNewSegment(uint64_t start_time, uint64_t duration, uint64_t size)
virtual int Group() const
Definition: mpd_builder.cc:816
virtual AdaptationSet * AddAdaptationSet(const std::string &lang)
Definition: mpd_builder.cc:408
This class generates DASH MPDs (Media Presentation Descriptions).
Definition: mpd_builder.h:56
virtual void ForceSetSegmentAlignment(bool segment_alignment)
Definition: mpd_builder.cc:806
virtual void SetSampleDuration(uint32_t sample_duration)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
virtual void SetGroup(int group_number)
Definition: mpd_builder.cc:812
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual Representation * AddRepresentation(const MediaInfo &media_info)
Definition: mpd_builder.cc:671
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
Definition: mpd_builder.cc:723
virtual bool ToString(std::string *output)
Definition: mpd_builder.cc:426
virtual void AddRole(Role role)
Definition: mpd_builder.cc:730
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
Definition: mpd_builder.cc:716