chromium/services/network/first_party_sets/first_party_sets_manager_unittest.cc

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

#include "services/network/first_party_sets/first_party_sets_manager.h"

#include <initializer_list>
#include <optional>
#include <set>
#include <string>

#include "base/containers/flat_set.h"
#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/version.h"
#include "net/base/features.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/first_party_set_metadata.h"
#include "net/first_party_sets/first_party_sets_context_config.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

IsEmpty;
Optional;
Pair;
UnorderedElementsAre;

const char* kDelayedQueriesCountHistogram =;
const char* kMostDelayedQueryDeltaHistogram =;

namespace network {

class WaitingFeatureInitializer {};

class FirstPartySetsManagerTest : public ::testing::Test,
                                  public WaitingFeatureInitializer {};

class FirstPartySetsManagerDisabledTest : public FirstPartySetsManagerTest {};

TEST_F(FirstPartySetsManagerDisabledTest, SetCompleteSets) {}

TEST_F(FirstPartySetsManagerDisabledTest, FindEntries) {}

class FirstPartySetsManagerEnabledTest : public FirstPartySetsManagerTest {};

TEST_F(FirstPartySetsManagerEnabledTest, SetCompleteSets) {}

TEST_F(FirstPartySetsManagerEnabledTest, SetCompleteSets_Idempotent) {}

// Test fixture that allows precise control over when the instance gets FPS
// data. Useful for testing async flows.
class AsyncPopulatedFirstPartySetsManagerTest
    : public FirstPartySetsManagerTest {};

class AsyncWaitingFirstPartySetsManagerTest
    : public AsyncPopulatedFirstPartySetsManagerTest {};

TEST_F(AsyncWaitingFirstPartySetsManagerTest,
       QueryBeforeReady_ComputeMetadata) {}

TEST_F(AsyncWaitingFirstPartySetsManagerTest, QueryBeforeReady_FindEntries) {}

class AsyncNonwaitingFirstPartySetsManagerTest
    : public AsyncPopulatedFirstPartySetsManagerTest {};

TEST_F(AsyncNonwaitingFirstPartySetsManagerTest,
       QueryBeforeReady_ComputeMetadata) {}

TEST_F(AsyncNonwaitingFirstPartySetsManagerTest, QueryBeforeReady_FindEntries) {}

}  // namespace network