Shaka Packager SDK
Loading...
Searching...
No Matches
mock_mpd_builder.h
1// Copyright 2015 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 MPD_BASE_MOCK_MPD_BUILDER_H_
8#define MPD_BASE_MOCK_MPD_BUILDER_H_
9
10#include <cstdint>
11#include <string>
12
13#include <gmock/gmock.h>
14
15#include <packager/mpd/base/adaptation_set.h>
16#include <packager/mpd/base/content_protection_element.h>
17#include <packager/mpd/base/mpd_builder.h>
18#include <packager/mpd/base/period.h>
19#include <packager/mpd/base/representation.h>
20
21namespace shaka {
22
23class MockMpdBuilder : public MpdBuilder {
24 public:
26 ~MockMpdBuilder() override;
27
28 MOCK_METHOD1(GetOrCreatePeriod, Period*(double start_time_in_seconds));
29 MOCK_METHOD1(ToString, bool(std::string* output));
30};
31
32class MockPeriod : public Period {
33 public:
34 MockPeriod(uint32_t period_id, double start_time_in_seconds);
35
36 MOCK_METHOD2(GetOrCreateAdaptationSet,
37 AdaptationSet*(const MediaInfo& media_info,
38 bool content_protection_in_adaptation_set));
39
40 private:
41 // Only for constructing the super class. Not used for testing.
42 uint32_t sequence_counter_ = 0;
43};
44
46 public:
48 ~MockAdaptationSet() override;
49
50 MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
51 MOCK_METHOD1(CopyRepresentation,
52 Representation*(const Representation& representation));
53 MOCK_METHOD1(AddContentProtectionElement,
54 void(const ContentProtectionElement& element));
55 MOCK_METHOD2(UpdateContentProtectionPssh,
56 void(const std::string& drm_uuid, const std::string& pssh));
57 MOCK_METHOD1(AddRole, void(AdaptationSet::Role role));
58 MOCK_METHOD1(ForceSetSegmentAlignment, void(bool segment_alignment));
59 MOCK_METHOD1(AddAdaptationSetSwitching,
60 void(const AdaptationSet* adaptation_set));
61 MOCK_METHOD1(AddTrickPlayReference,
62 void(const AdaptationSet* adaptation_set));
63 MOCK_METHOD2(AddAccessibility,
64 void(const std::string& scheme, const std::string& value));
65
66 private:
67 // Only for constructing the super class. Not used for testing.
68 uint32_t sequence_counter_ = 0;
69};
70
72 public:
73 // |representation_id| is the numeric ID for the <Representation>.
74 explicit MockRepresentation(uint32_t representation_id);
75 ~MockRepresentation() override;
76
77 MOCK_METHOD1(AddContentProtectionElement,
78 void(const ContentProtectionElement& element));
79 MOCK_METHOD2(UpdateContentProtectionPssh,
80 void(const std::string& drm_uuid, const std::string& pssh));
81 MOCK_METHOD4(AddNewSegment,
82 void(int64_t start_time,
83 int64_t duration,
84 uint64_t size,
85 int64_t segment_number));
86 MOCK_METHOD0(SetSegmentDuration, void());
87 MOCK_METHOD0(SetAvailabilityTimeOffset, void());
88 MOCK_METHOD1(SetSampleDuration, void(int32_t sample_duration));
89 MOCK_CONST_METHOD0(GetMediaInfo, const MediaInfo&());
90};
91
92} // namespace shaka
93
94#endif // MPD_BASE_MOCK_MPD_BUILDER_H_
virtual Representation * AddRepresentation(const MediaInfo &media_info)
virtual void AddAccessibility(const std::string &scheme, const std::string &value)
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual void ForceSetSegmentAlignment(bool segment_alignment)
virtual Representation * CopyRepresentation(const Representation &representation)
virtual void AddTrickPlayReference(const AdaptationSet *adaptation_set)
virtual void AddAdaptationSetSwitching(const AdaptationSet *adaptation_set)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
virtual void AddRole(Role role)
This class generates DASH MPDs (Media Presentation Descriptions).
Definition mpd_builder.h:37
virtual Period * GetOrCreatePeriod(double start_time_in_seconds)
virtual bool ToString(std::string *output)
virtual AdaptationSet * GetOrCreateAdaptationSet(const MediaInfo &media_info, bool content_protection_in_adaptation_set)
Definition period.cc:84
double start_time_in_seconds() const
Definition period.h:58
virtual void AddContentProtectionElement(const ContentProtectionElement &element)
virtual void AddNewSegment(int64_t start_time, int64_t duration, uint64_t size, int64_t segment_number)
virtual void UpdateContentProtectionPssh(const std::string &drm_uuid, const std::string &pssh)
virtual const MediaInfo & GetMediaInfo() const
virtual void SetSampleDuration(int32_t sample_duration)
All the methods that are virtual are virtual for mocking.