#include "content/browser/interest_group/interest_group_k_anonymity_manager.h"
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "content/browser/interest_group/interest_group_manager_impl.h"
#include "content/browser/interest_group/interest_group_update.h"
#include "content/browser/interest_group/storage_interest_group.h"
#include "content/services/auction_worklet/public/mojom/bidder_worklet.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include "url/origin.h"
namespace content {
namespace {
constexpr base::TimeDelta kJoinInterval = …;
constexpr base::TimeDelta kQueryInterval = …;
constexpr char kAdURL[] = …;
constexpr char kBiddingURL[] = …;
constexpr char kUpdateURL[] = …;
class TestKAnonymityServiceDelegate : public KAnonymityServiceDelegate { … };
blink::InterestGroup MakeInterestGroup(url::Origin owner, std::string name) { … }
blink::InterestGroup CreateAndJoinInterestGroup(
const url::Origin& owner,
const std::string& name,
InterestGroupManagerImpl* manager,
const GURL& joining_url) { … }
}
class InterestGroupKAnonymityManagerTest : public testing::Test { … };
TEST_F(InterestGroupKAnonymityManagerTest,
QueueUpdatePerformsQuerySetsForGroup) { … }
TEST_F(
InterestGroupKAnonymityManagerTest,
QueueUpdateCorrectlyChoosesWhetherToReplaceOrMergeWithExistingKanonValues) { … }
TEST_F(InterestGroupKAnonymityManagerTest,
RegisterAdKeysAsJoinedPerformsJoinSet) { … }
TEST_F(InterestGroupKAnonymityManagerTest, HandlesServerErrors) { … }
class MockAnonymityServiceDelegate : public KAnonymityServiceDelegate { … };
class InterestGroupKAnonymityManagerTestWithMock
: public InterestGroupKAnonymityManagerTest { … };
TEST_F(InterestGroupKAnonymityManagerTestWithMock,
JoinSetShouldNotRequestDuplicates) { … }
TEST_F(InterestGroupKAnonymityManagerTestWithMock,
QuerySetShouldHandleOverlappingRequests) { … }
TEST_F(InterestGroupKAnonymityManagerTestWithMock,
QuerySetShouldHandleOutdatedOutstandingRequest) { … }
TEST_F(InterestGroupKAnonymityManagerTestWithMock, QuerySetShouldBatch) { … }
}