2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2014 Google LLC. All rights reserved.
|
2014-02-05 02:32:46 +00:00
|
|
|
//
|
|
|
|
// 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_TEST_MPD_BUILDER_TEST_HELPER_H_
|
|
|
|
#define MPD_TEST_MPD_BUILDER_TEST_HELPER_H_
|
|
|
|
|
2023-08-05 03:45:21 +00:00
|
|
|
#include <filesystem>
|
2014-02-05 02:32:46 +00:00
|
|
|
#include <string>
|
|
|
|
|
2017-12-14 06:33:47 +00:00
|
|
|
#include "packager/mpd/base/media_info.pb.h"
|
2014-02-05 02:32:46 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
class MediaInfo;
|
|
|
|
|
|
|
|
// File names that could be used to call GetTestDataFilePath().
|
2015-06-09 22:29:14 +00:00
|
|
|
// TODO(rkuroiwa): Seems like too may indirection. Maybe put the definition
|
|
|
|
// of the proto instance in this file. Or just remove this and put it in the
|
|
|
|
// test.
|
2014-02-05 02:32:46 +00:00
|
|
|
const char kFileNameVideoMediaInfo1[] = "video_media_info1.txt";
|
|
|
|
const char kFileNameVideoMediaInfo2[] = "video_media_info2.txt";
|
|
|
|
const char kFileNameAudioMediaInfo1[] = "audio_media_info1.txt";
|
|
|
|
|
|
|
|
// These are the expected output files.
|
|
|
|
const char kFileNameExpectedMpdOutputVideo1[] =
|
|
|
|
"video_media_info1_expected_mpd_output.txt";
|
|
|
|
|
|
|
|
const char kFileNameExpectedMpdOutputVideo1And2[] =
|
|
|
|
"video_media_info1and2_expected_mpd_output.txt";
|
|
|
|
|
|
|
|
const char kFileNameExpectedMpdOutputAudio1[] =
|
|
|
|
"audio_media_info1_expected_mpd_output.txt";
|
|
|
|
|
|
|
|
const char kFileNameExpectedMpdOutputAudio1AndVideo1[] =
|
|
|
|
"audio_media_info1_video_media_info1_expected_mpd_output.txt";
|
|
|
|
|
|
|
|
// Returns the path to test data with |file_name|. Use constants above to get
|
|
|
|
// path to the test files.
|
2023-08-05 03:45:21 +00:00
|
|
|
std::filesystem::path GetTestDataFilePath(const std::string& file_name);
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
// Get path to DASH MPD schema.
|
2023-08-05 03:45:21 +00:00
|
|
|
std::filesystem::path GetSchemaPath();
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
// Convert |media_info_string| to MediaInfo.
|
|
|
|
MediaInfo ConvertToMediaInfo(const std::string& media_info_string);
|
|
|
|
|
|
|
|
// This is equivalent to
|
|
|
|
// return input_file >>= GetTestDataFilePath >>= GetPathContent >>= GetMediaInfo
|
|
|
|
// i.e. calling the functions with |media_info_file_name|.
|
|
|
|
MediaInfo GetTestMediaInfo(const std::string& media_info_file_name);
|
|
|
|
|
|
|
|
// Return true if |mpd| is a valid MPD.
|
|
|
|
bool ValidateMpdSchema(const std::string& mpd);
|
|
|
|
|
|
|
|
// |expected_output_file| should be the file name that has expected output in
|
|
|
|
// test data dir.
|
|
|
|
// This checks if |mpd_string| and the content of |expected_output_file| are
|
|
|
|
// equal.
|
|
|
|
void ExpectMpdToEqualExpectedOutputFile(
|
|
|
|
const std::string& mpd_string,
|
|
|
|
const std::string& expected_output_file);
|
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2014-02-05 02:32:46 +00:00
|
|
|
|
|
|
|
#endif // MPD_TEST_MPD_BUILDER_TEST_HELPER_H_
|