chromium/components/cdm/common/cdm_manifest_unittest.cc

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

#include "components/cdm/common/cdm_manifest.h"

#include <stdint.h>
#include <memory>
#include <string>
#include <vector>

#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_file_value_serializer.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "base/version.h"
#include "content/public/common/cdm_info.h"
#include "media/base/cdm_capability.h"
#include "media/cdm/api/content_decryption_module.h"
#include "media/cdm/supported_cdm_versions.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"

CdmCapability;

namespace {

// These names must match what is used in cdm_manifest.cc.
const char kCdmVersion[] =;
const char kCdmModuleVersionsName[] =;
const char kCdmInterfaceVersionsName[] =;
const char kCdmHostVersionsName[] =;
const char kCdmCodecsListName[] =;
const char kCdmPersistentLicenseSupportName[] =;
const char kCdmSupportedEncryptionSchemesName[] =;

// Version checking does change over time. Deriving these values from constants
// in the code to ensure they change when the CDM interface changes.
// |kSupportedCdmInterfaceVersion| and |kSupportedCdmHostVersion| are the
// minimum versions supported. There may be versions after them that are also
// supported.
constexpr int kSupportedCdmModuleVersion =;
constexpr int kSupportedCdmInterfaceVersion =;
static_assert;
constexpr int kSupportedCdmHostVersion =;

// Make a string of the values from 0 up to and including |item|.
std::string MakeStringList(int item) {}

base::Value::List MakeList(const std::string& item) {}

base::Value::List MakeList(const std::string& item1, const std::string& item2) {}

// Create a default manifest with valid values for all entries.
base::Value::Dict DefaultManifest() {}

void CheckVideoCodecs(const media::CdmCapability::VideoCodecMap& actual,
                      const std::vector<media::VideoCodec>& expected) {}

void CheckAudioCodecs(const base::flat_set<media::AudioCodec>& actual,
                      const std::vector<media::AudioCodec>& expected) {}

void CheckEncryptionSchemes(
    const base::flat_set<media::EncryptionScheme>& actual,
    const std::vector<media::EncryptionScheme>& expected) {}

void CheckSessionTypes(const base::flat_set<media::CdmSessionType>& actual,
                       const std::vector<media::CdmSessionType>& expected) {}

void WriteManifestToFile(const base::ValueView manifest,
                         const base::FilePath& file_path) {}

}  // namespace

TEST(CdmManifestTest, IsCompatibleWithChrome) {}

TEST(CdmManifestTest, InCompatibleModuleVersion) {}

TEST(CdmManifestTest, InCompatibleInterfaceVersion) {}

TEST(CdmManifestTest, InCompatibleHostVersion) {}

TEST(CdmManifestTest, IsCompatibleWithMultipleValues) {}

TEST(CdmManifestTest, ValidManifest) {}

TEST(CdmManifestTest, EmptyManifest) {}

TEST(CdmManifestTest, ManifestCodecs) {}

TEST(CdmManifestTest, ManifestEncryptionSchemes) {}

TEST(CdmManifestTest, ManifestSessionTypes) {}

TEST(CdmManifestTest, FileManifest) {}

TEST(CdmManifestTest, FileManifestNoVersion) {}

TEST(CdmManifestTest, FileManifestBadVersion) {}

TEST(CdmManifestTest, FileManifestDoesNotExist) {}

TEST(CdmManifestTest, FileManifestEmpty) {}

TEST(CdmManifestTest, FileManifestLite) {}

TEST(CdmManifestTest, FileManifestNotDictionary) {}