2014-02-14 23:21:05 +00:00
|
|
|
// Copyright 2014 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
|
|
|
|
|
2013-12-30 23:05:27 +00:00
|
|
|
#include "base/file_util.h"
|
|
|
|
#include "base/logging.h"
|
|
|
|
#include "mpd/base/mpd_builder.h"
|
2014-02-05 02:32:46 +00:00
|
|
|
#include "mpd/test/mpd_builder_test_helper.h"
|
2013-12-30 23:05:27 +00:00
|
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
|
|
|
|
namespace dash_packager {
|
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
TEST(MpdBuilderTest, VOD_Video) {
|
2013-12-30 23:05:27 +00:00
|
|
|
MpdBuilder mpd(MpdBuilder::kStatic);
|
2014-02-05 02:32:46 +00:00
|
|
|
MediaInfo video_media_info = GetTestMediaInfo(kFileNameVideoMediaInfo1);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
AdaptationSet* video_adaptation_set = mpd.AddAdaptationSet();
|
|
|
|
ASSERT_TRUE(video_adaptation_set);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
Representation* video_representation =
|
|
|
|
video_adaptation_set->AddRepresentation(video_media_info);
|
|
|
|
ASSERT_TRUE(video_adaptation_set);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
|
|
|
std::string mpd_doc;
|
|
|
|
ASSERT_TRUE(mpd.ToString(&mpd_doc));
|
|
|
|
ASSERT_TRUE(ValidateMpdSchema(mpd_doc));
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
EXPECT_NO_FATAL_FAILURE(ExpectMpdToEqualExpectedOutputFile(
|
|
|
|
mpd_doc, kFileNameExpectedMpdOutputVideo1));
|
2013-12-30 23:05:27 +00:00
|
|
|
}
|
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
TEST(MpdBuilderTest, VOD_VideoAndAudio) {
|
2013-12-30 23:05:27 +00:00
|
|
|
MpdBuilder mpd(MpdBuilder::kStatic);
|
2014-02-05 02:32:46 +00:00
|
|
|
MediaInfo video_media_info = GetTestMediaInfo(kFileNameVideoMediaInfo1);
|
|
|
|
MediaInfo audio_media_info = GetTestMediaInfo(kFileNameAudioMediaInfo1);
|
|
|
|
|
|
|
|
// The order matters here to check against expected output.
|
|
|
|
// TODO(rkuroiwa): Investigate if I can deal with IDs and order elements
|
|
|
|
// deterministically.
|
|
|
|
AdaptationSet* video_adaptation_set = mpd.AddAdaptationSet();
|
|
|
|
ASSERT_TRUE(video_adaptation_set);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
AdaptationSet* audio_adaptation_set = mpd.AddAdaptationSet();
|
|
|
|
ASSERT_TRUE(audio_adaptation_set);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
2014-02-05 02:32:46 +00:00
|
|
|
Representation* audio_representation =
|
|
|
|
audio_adaptation_set->AddRepresentation(audio_media_info);
|
|
|
|
ASSERT_TRUE(audio_representation);
|
|
|
|
|
|
|
|
Representation* video_representation =
|
|
|
|
video_adaptation_set->AddRepresentation(video_media_info);
|
|
|
|
ASSERT_TRUE(video_adaptation_set);
|
2013-12-30 23:05:27 +00:00
|
|
|
|
|
|
|
std::string mpd_doc;
|
|
|
|
ASSERT_TRUE(mpd.ToString(&mpd_doc));
|
|
|
|
ASSERT_TRUE(ValidateMpdSchema(mpd_doc));
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
EXPECT_NO_FATAL_FAILURE(ExpectMpdToEqualExpectedOutputFile(
|
|
|
|
mpd_doc, kFileNameExpectedMpdOutputAudio1AndVideo1));
|
2013-12-30 23:05:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dash_packager
|