chromium/media/base/test_data_util.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/base/test_data_util.h"

#include <stdint.h>
#include <ostream>

#include "base/check_op.h"
#include "base/containers/flat_map.h"
#include "base/files/file_util.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/path_service.h"

namespace media {

namespace {

// Mime types for test files. Sorted in the ASCII code order of the variable
// names.
const char kAacAdtsAudio[] =;
const char kMp2AudioSBR[] =;
const char kMp2tAudioVideo[] =;
const char kMp3Audio[] =;
// MP4
const char kMp4AacAudio[] =;
const char kMp4Av110bitVideo[] =;
const char kMp4Av1Video[] =;
const char kMp4Av1VideoOpusAudio[] =;
const char kMp4Avc1Video[] =;
const char kMp4AacAudioAvc1Video[] =;
const char kMp4Avc3Video[] =;
const char kMp4FlacAudio[] =;
const char kMp4OpusAudio[] =;
const char kMp4Vp9Profile2Video[] =;
const char kMp4Vp9Video[] =;
const char kMp4XheAacAudio[] =;
// WebM
const char kWebMAv110bitVideo[] =;
const char kWebMAv1Video[] =;
const char kWebMOpusAudio[] =;
const char kWebMOpusAudioVp9Video[] =;
const char kWebMVorbisAudio[] =;
const char kWebMVorbisAudioVp8Video[] =;
const char kWebMVp8Video[] =;
const char kWebMVp9Profile2Video[] =;
const char kWebMVp9Video[] =;

// A map from a test file name to its mime type. The file is located at
// media/test/data.
FileToMimeTypeMap;

// Wrapped to avoid static initializer startup cost. The list is sorted in the
// the ASCII code order of file names.
// Note: Some files are old and the codec string in the mime type may not be
// accurate.
// Warning: When adding new files, make sure the codec string is accurate. For
// example kMp4Avc1Video is for H264 high profile. If you add a file that uses
// main profile, a new mime type should be added.
const FileToMimeTypeMap& GetFileToMimeTypeMap() {}

// Key used to encrypt test files.
const uint8_t kSecretKey[] =;

// The key ID for all encrypted files.
const uint8_t kKeyId[] =;

}  // namespace

// TODO(sandersd): Change the tests to use a more unique message.
// See http://crbug.com/592067

// Common test results.
const char kFailedTitle[] =;

// Upper case event name set by Utils.installTitleEventHandler().
const char kEndedTitle[] =;
const char kErrorEventTitle[] =;

// Lower case event name as set by Utils.failTest().
const char kErrorTitle[] =;

const base::FilePath::CharType kTestDataPath[] =);

const base::span<const uint8_t> ExternalMemoryAdapterForTesting::Span() const {}

base::FilePath GetTestDataFilePath(std::string_view name) {}

base::FilePath GetTestDataPath() {}

std::string GetMimeTypeForFile(std::string_view file_name) {}

std::string GetURLQueryString(const base::StringPairs& query_params) {}

scoped_refptr<DecoderBuffer> ReadTestDataFile(std::string_view name) {}

scoped_refptr<DecoderBuffer> ReadTestDataFile(std::string_view name,
                                              base::TimeDelta pts) {}

bool LookupTestKeyVector(const std::vector<uint8_t>& key_id,
                         bool allow_rotation,
                         std::vector<uint8_t>* key) {}

bool LookupTestKeyString(std::string_view key_id,
                         bool allow_rotation,
                         std::string* key) {}

}  // namespace media