#include "content/browser/interest_group/bidding_and_auction_server_key_fetcher.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "content/browser/interest_group/interest_group_features.h"
#include "content/browser/interest_group/interest_group_manager_impl.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
const char kDefaultGCPKeyURL[] = …;
const char kOtherDefaultGCPKeyURL[] = …;
const char kCoordinator1[] = …;
const char kCoordinator1KeyURL[] = …;
const char kCoordinator2[] = …;
const char kCoordinator2KeyURL[] = …;
class BiddingAndAuctionServerKeyFetcherTest : public testing::Test { … };
TEST_F(BiddingAndAuctionServerKeyFetcherTest, UnknownCoordinator) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, NoURL) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, BadResponses) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, FailsAll) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, RequestDuringFailure) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, GoodResponse) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, RequestDuringSuccess) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, CachesValue) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, ReadsValuesCachedInDBIfEnabled) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, WritesValuesToDBIfEnabled) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest,
MaybePrefetchKeysFailureFailsPendingGetOrFetchKey) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, MaybePrefetchKeysCachesValue) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest,
MaybePrefetchKeysUpdatesExpiredValue) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest,
MaybePrefetchKeysDoesNotCacheValueIfFeatureDisabled) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, CoalescesRequests) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, ChoosesRandomKey) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, OverridesConfig) { … }
TEST_F(BiddingAndAuctionServerKeyFetcherTest, NoConfigOnlyURL) { … }
class BiddingAndAuctionServerKeyFetcherCoordinatorTest
: public BiddingAndAuctionServerKeyFetcherTest,
public ::testing::WithParamInterface<int> { … };
TEST_P(BiddingAndAuctionServerKeyFetcherCoordinatorTest, GoodResponse) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}