chromium/content/browser/media/cdm_storage_database_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 <stdint.h>
#include <string>
#include <vector>

#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/test/metrics/histogram_tester.h"
#include "content/browser/media/cdm_storage_database.h"
#include "content/public/browser/browsing_data_filter_builder.h"
#include "media/cdm/cdm_type.h"
#include "sql/database.h"
#include "sql/meta_table.h"
#include "sql/statement.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"

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 =;
const std::vector<uint8_t> kPopulatedFileValueThree =;
}  // namespace

class CdmStorageDatabaseTest : public testing::Test {};

// This class is to test for when db_.Open() fails.
class CdmStorageDatabaseInvalidOpenTest : public CdmStorageDatabaseTest {};

// This class tests the CdmStorageDatabase when the path is empty.
class CdmStorageDatabaseInMemoryTest : public CdmStorageDatabaseTest {};

// This class tests the CdmStorageDatabase with the CdmStorage path.
class CdmStorageDatabaseValidPathTest : public CdmStorageDatabaseTest {};

class MockCdmStorageDatabaseV1 {};

// This class is to test for the migration from v1 to v2 of the
// CdmStorageDatabase.
class CdmStorageDatabaseV1Test : public CdmStorageDatabaseTest {};

// Update this test and follow CdmStorageDatabaseV1Test when V3 comes out.
class CdmStorageDatabaseV2Test : public CdmStorageDatabaseTest {};

TEST_F(CdmStorageDatabaseV1Test, V1Works) {}

TEST_F(CdmStorageDatabaseV1Test, V1UpgradeWorks) {}

TEST_F(CdmStorageDatabaseV2Test, V2Works) {}

TEST_F(CdmStorageDatabaseInvalidOpenTest, EnsureOpenFails) {}

TEST_F(CdmStorageDatabaseInMemoryTest, EnsureOpenWithoutErrors) {}

TEST_F(CdmStorageDatabaseInMemoryTest, FileManipulation) {}

TEST_F(CdmStorageDatabaseInMemoryTest, DeleteDatabase) {}

TEST_F(CdmStorageDatabaseInMemoryTest, DeleteForStorageKey) {}

TEST_F(CdmStorageDatabaseInMemoryTest, DeleteForStorageKeyWithNoData) {}

TEST_F(CdmStorageDatabaseInMemoryTest,
       DeleteForTimeFrameMultipleFilesAndStorageKeysTimeFrame) {}

TEST_F(CdmStorageDatabaseInMemoryTest, DeleteForTimeFrameWithNoData) {}

TEST_F(CdmStorageDatabaseInMemoryTest, WriteFileForBigData) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForFile) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForNonExistentFile) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForStorageKey) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForNonExistentStorageKey) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForMultipleFilesInStorageKey) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForTimeFrame) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsageForNonExistentTimeFrame) {}

TEST_F(CdmStorageDatabaseInMemoryTest,
       GetUsageForMultipleFilesAndStorageKeysTimeFrame) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsagePerAllStorageKeys) {}

TEST_F(CdmStorageDatabaseInMemoryTest, GetUsagePerAllStorageKeysTimeBound) {}

TEST_F(CdmStorageDatabaseInMemoryTest, DeleteDataForFilter) {}

TEST_F(CdmStorageDatabaseInMemoryTest, PreserveDataForFilter) {}

TEST_F(CdmStorageDatabaseValidPathTest, EnsureOpenWithoutErrors) {}

TEST_F(CdmStorageDatabaseValidPathTest, FileManipulation) {}

TEST_F(CdmStorageDatabaseValidPathTest, DeleteDatabase) {}

TEST_F(CdmStorageDatabaseValidPathTest, DeleteForStorageKey) {}

TEST_F(CdmStorageDatabaseValidPathTest, DeleteForStorageKeyWithNoData) {}

TEST_F(CdmStorageDatabaseValidPathTest,
       DeleteForTimeFrameMultipleFilesAndStorageKeysTimeFrame) {}

TEST_F(CdmStorageDatabaseValidPathTest, DeleteForTimeFrameWithNoData) {}

TEST_F(CdmStorageDatabaseValidPathTest, WriteFileForBigData) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForFile) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForNonExistentFile) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForStorageKey) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForNonExistentStorageKey) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForMultipleFilesInStorageKey) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForTimeFrame) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsageForNonExistentTimeFrame) {}

TEST_F(CdmStorageDatabaseValidPathTest,
       GetUsageForMultipleFilesAndStorageKeysTimeFrame) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsagePerAllStorageKeys) {}

TEST_F(CdmStorageDatabaseValidPathTest, GetUsagePerAllStorageKeysTimeBound) {}

TEST_F(CdmStorageDatabaseValidPathTest, DeleteDataForFilter) {}

TEST_F(CdmStorageDatabaseValidPathTest, PreserveDataForFilter) {}

}  // namespace content