chromium/content/browser/media/cdm_storage_manager_unittest.cc

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

#include "content/browser/media/cdm_storage_manager.h"

#include <string>

#include "base/test/task_environment.h"
#include "base/test/test_file_util.h"
#include "base/test/test_future.h"
#include "media/mojo/mojom/cdm_storage.mojom.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"

CdmFile;
CdmStorage;

namespace content {

namespace {

const media::CdmType kCdmType{};

const char kFileName[] =;
const char kFileNameTwo[] =;

const std::vector<uint8_t> kPopulatedFileValue =;
const std::vector<uint8_t> kPopulatedFileValueTwo =;

std::vector<uint8_t> kEmptyFileValue;

}  // namespace

// TODO(crbug.com/40272342): Add a DeleteFile test once there is a way to check
// that the db is actually deleted.

class CdmStorageManagerTest : public testing::Test {};

class CdmStorageManagerSingularTest : public CdmStorageManagerTest,
                                      public testing::WithParamInterface<bool> {};

class CdmStorageManagerMultipleTest
    : public CdmStorageManagerTest,
      public testing::WithParamInterface<std::tuple<bool, bool>> {};

// This test case tests deletion of a file.
TEST_P(CdmStorageManagerSingularTest, DeleteFile) {}

// This test case tests deletion of a non existent file to make sure it doesn't
// affect any other files in the database.
TEST_P(CdmStorageManagerSingularTest, DeleteNonExistentFile) {}

// This test cases tests that we accurately delete data for a storage key
// without touching other data in the database.
TEST_P(CdmStorageManagerSingularTest, DeleteDataForStorageKey) {}

TEST_P(CdmStorageManagerSingularTest, DeleteFileNoDatabase) {}

// This test case tests when there is a file written to the CdmStorageDatabase
// from two different profiles with the same file name, cdm type, and storage
// key. We want to make sure that although they share the same qualities,
// deleting the file from one of the profiles does not affect the other profile.
TEST_P(CdmStorageManagerMultipleTest, DeleteFile) {}

// This tests deletion of multiple files under the same storage key. Since the
// files are written from multiple profiles with the same storage key, we verify
// that deletion from one profile does not affect the files written to the same
// storage key from another profile.
TEST_P(CdmStorageManagerMultipleTest, DeleteDataForStorageKey) {}

TEST_P(CdmStorageManagerMultipleTest, DeleteDataForStorageKeyTimeSpecified) {}

TEST_P(CdmStorageManagerMultipleTest, DeleteFileNoDatabase) {}

TEST_P(CdmStorageManagerMultipleTest, GetSizeForFileNoDatabase) {}

TEST_P(CdmStorageManagerMultipleTest, GetSizeForTests) {}

// `testing::Bool()` represents either incognito, or a non incognito profile, so
// that we test on both.
INSTANTIATE_TEST_SUITE_P();

// The pairs represent different combinations of the types of profiles that
// can exist on Chrome together.
INSTANTIATE_TEST_SUITE_P();

}  // namespace content