2015-07-16 06:51:24 +00:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
|
|
|
#ifndef MPD_BASE_MOCK_MPD_BUILDER_H_
|
|
|
|
#define MPD_BASE_MOCK_MPD_BUILDER_H_
|
|
|
|
|
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
|
|
|
#include "packager/base/compiler_specific.h"
|
2015-11-12 21:40:52 +00:00
|
|
|
#include "packager/base/synchronization/lock.h"
|
2015-07-16 06:51:24 +00:00
|
|
|
#include "packager/mpd/base/content_protection_element.h"
|
|
|
|
#include "packager/mpd/base/mpd_builder.h"
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
class MockMpdBuilder : public MpdBuilder {
|
|
|
|
public:
|
2015-07-22 06:57:21 +00:00
|
|
|
// |type| indicates whether the MPD should be for VOD or live content (kStatic
|
2015-07-16 06:51:24 +00:00
|
|
|
// for VOD profile, or kDynamic for live profile).
|
|
|
|
explicit MockMpdBuilder(MpdType type);
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockMpdBuilder() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(AddAdaptationSet, AdaptationSet*(const std::string& lang));
|
|
|
|
MOCK_METHOD1(ToString, bool(std::string* output));
|
|
|
|
};
|
|
|
|
|
|
|
|
class MockAdaptationSet : public AdaptationSet {
|
|
|
|
public:
|
2015-07-22 06:57:21 +00:00
|
|
|
// |adaptation_set_id| is the id for the AdaptationSet.
|
|
|
|
explicit MockAdaptationSet(uint32_t adaptation_set_id);
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockAdaptationSet() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(AddRepresentation, Representation*(const MediaInfo& media_info));
|
2015-07-22 06:57:21 +00:00
|
|
|
MOCK_METHOD1(AddContentProtectionElement,
|
|
|
|
void(const ContentProtectionElement& element));
|
2015-09-24 22:03:52 +00:00
|
|
|
MOCK_METHOD2(UpdateContentProtectionPssh,
|
|
|
|
void(const std::string& drm_uuid, const std::string& pssh));
|
2015-08-05 23:00:02 +00:00
|
|
|
MOCK_METHOD1(AddRole, void(AdaptationSet::Role role));
|
2015-10-29 20:58:36 +00:00
|
|
|
MOCK_METHOD1(ForceSetSegmentAlignment, void(bool segment_alignment));
|
2015-07-22 06:57:21 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(SetGroup, void(int group_number));
|
|
|
|
MOCK_CONST_METHOD0(Group, int());
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Only for constructing the super class. Not used for testing.
|
|
|
|
base::AtomicSequenceNumber sequence_counter_;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MockRepresentation : public Representation {
|
|
|
|
public:
|
|
|
|
// |representation_id| is the numeric ID for the <Representation>.
|
|
|
|
explicit MockRepresentation(uint32_t representation_id);
|
2015-07-22 23:40:45 +00:00
|
|
|
~MockRepresentation() override;
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
MOCK_METHOD1(AddContentProtectionElement,
|
|
|
|
void(const ContentProtectionElement& element));
|
2015-09-24 22:03:52 +00:00
|
|
|
MOCK_METHOD2(UpdateContentProtectionPssh,
|
|
|
|
void(const std::string& drm_uuid, const std::string& pssh));
|
2015-07-16 06:51:24 +00:00
|
|
|
MOCK_METHOD3(AddNewSegment,
|
|
|
|
void(uint64_t start_time, uint64_t duration, uint64_t size));
|
|
|
|
MOCK_METHOD1(SetSampleDuration, void(uint32_t sample_duration));
|
|
|
|
};
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-07-16 06:51:24 +00:00
|
|
|
|
|
|
|
#endif // MPD_BASE_MOCK_MPD_BUILDER_H_
|