chromium/components/blocklist/opt_out_blocklist/opt_out_blocklist_unittest.cc

// Copyright 2018 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 "components/blocklist/opt_out_blocklist/opt_out_blocklist.h"

#include <algorithm>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/blocklist/opt_out_blocklist/opt_out_blocklist_delegate.h"
#include "components/blocklist/opt_out_blocklist/opt_out_blocklist_item.h"
#include "components/blocklist/opt_out_blocklist/opt_out_store.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace blocklist {

namespace {

const char kTestHost1[] =;
const char kTestHost2[] =;

// Mock class to test that OptOutBlocklist notifies the delegate with correct
// events (e.g. New host blocklisted, user blocklisted, and blocklist cleared).
class TestOptOutBlocklistDelegate : public OptOutBlocklistDelegate {};

class TestOptOutStore : public OptOutStore {};

class TestOptOutBlocklist : public OptOutBlocklist {};

class OptOutBlocklistTest : public testing::Test {};

TEST_F(OptOutBlocklistTest, HostBlockListNoStore) {}

TEST_F(OptOutBlocklistTest, TypeBlockListWithStore) {}

TEST_F(OptOutBlocklistTest, TypeBlockListNoStore) {}

TEST_F(OptOutBlocklistTest, HostIndifferentBlocklist) {}

TEST_F(OptOutBlocklistTest, QueueBehavior) {}

TEST_F(OptOutBlocklistTest, MaxHosts) {}

TEST_F(OptOutBlocklistTest, SingleOptOut) {}

TEST_F(OptOutBlocklistTest, ClearingBlockListClearsRecentNavigation) {}

TEST_F(OptOutBlocklistTest, ObserverIsNotifiedOnHostBlocklisted) {}

TEST_F(OptOutBlocklistTest, ObserverIsNotifiedOnUserBlocklisted) {}

TEST_F(OptOutBlocklistTest, ObserverIsNotifiedWhenLoadBlocklistDone) {}

TEST_F(OptOutBlocklistTest, ObserverIsNotifiedOfHistoricalBlocklistedHosts) {}

TEST_F(OptOutBlocklistTest, PassedReasonsWhenBlocklistDataNotLoaded) {}

TEST_F(OptOutBlocklistTest, PassedReasonsWhenUserRecentlyOptedOut) {}

TEST_F(OptOutBlocklistTest, PassedReasonsWhenUserBlocklisted) {}

TEST_F(OptOutBlocklistTest, PassedReasonsWhenHostBlocklisted) {}

TEST_F(OptOutBlocklistTest, PassedReasonsWhenAllowed) {}

}  // namespace

}  // namespace blocklist