chromium/chrome/browser/permissions/crowd_deny_preload_data_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 "chrome/browser/permissions/crowd_deny_preload_data.h"

#include <string_view>

#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/numerics/safe_conversions.h"
#include "base/test/task_environment.h"
#include "base/version.h"
#include "chrome/browser/permissions/crowd_deny.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace {

constexpr char kTestDomainAlpha[] =;
constexpr char kTestDomainBeta[] =;
constexpr char kTestDomainGamma[] =;
constexpr char kTestDomainDelta[] =;
constexpr char kTestSubdomainOfDelta1[] =;
constexpr char kTestDomainEpsilon[] =;

constexpr char kTestOriginAlpha[] =;
constexpr char kTestOriginSubdomainOfAlpha[] =;
constexpr char kTestOriginBeta[] =;
constexpr char kTestOriginGamma[] =;
constexpr char kTestOriginDelta[] =;
constexpr char kTestOriginSubdomainOfDelta1[] =;
constexpr char kTestOriginSubdomainOfDelta2[] =;
constexpr char kTestOriginNotSubdomainOfDelta[] =;
constexpr char kTestOriginEpsilon[] =;
constexpr char kTestOriginZeta[] =;

constexpr const char* kAllTestingOrigins[] =;

}  // namespace

class CrowdDenyPreloadDataTest : public testing::Test {};

TEST_F(CrowdDenyPreloadDataTest, NoData) {}

TEST_F(CrowdDenyPreloadDataTest, MissingFile) {}

TEST_F(CrowdDenyPreloadDataTest, EmptyData) {}

TEST_F(CrowdDenyPreloadDataTest, BadData) {}

TEST_F(CrowdDenyPreloadDataTest, DataIntegrityAndDefaults) {}

TEST_F(CrowdDenyPreloadDataTest, GetReputationReturnsNullForNonHttpsOrigins) {}

TEST_F(CrowdDenyPreloadDataTest, GetReputationIgnoresPort) {}

TEST_F(CrowdDenyPreloadDataTest, GetReputationWithSubdomainMatching) {}

TEST_F(CrowdDenyPreloadDataTest, SubdomainSpecificOverride) {}

TEST_F(CrowdDenyPreloadDataTest, Update) {}

TEST_F(CrowdDenyPreloadDataTest, UpdateToMissingFileWipesInMemoryState) {}

TEST_F(CrowdDenyPreloadDataTest, UpdateToEmptyFileWipesInMemoryState) {}

TEST_F(CrowdDenyPreloadDataTest, UpdateToBadFileWipesInMemoryState) {}

// During start-up congestion, it is possible that a new version of the
// component becomes available while the old version is pending being loaded.
// Ensure that when things settle down, the last version loaded will prevail,
// and nothing explodes on the way.
TEST_F(CrowdDenyPreloadDataTest, LastOneSurvivesFromUpdatesInQuickSuccession) {}