#include "content/browser/interest_group/bidding_and_auction_response.h"
#include <optional>
#include <string>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "content/browser/aggregation_service/aggregation_service_features.h"
#include "content/services/auction_worklet/public/mojom/private_aggregation_request.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/interest_group/interest_group.h"
#include "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
namespace {
const char kOwnerOrigin[] = …;
const char kUntrustedURL[] = …;
const char kReportingURL[] = …;
const char kAggregationCoordinator[] = …;
const char kAggregationCoordinator2[] = …;
const char kDebugReportingURL[] = …;
const base::flat_map<url::Origin, std::vector<std::string>> GroupNames() { … }
const base::flat_map<blink::InterestGroupKey, url::Origin>
GroupAggregationCoordinators() { … }
BiddingAndAuctionResponse CreateExpectedValidResponse() { … }
base::Value::Dict CreateValidResponseDict() { … }
base::Value::List CreateBasicContributions() { … }
base::Value::List CreateBasicEventContributions(
const std::string& event = "reserved.win") { … }
base::Value::Dict CreateResponseDictWithPAggResponse(
base::Value::List contributions,
const std::optional<std::string>& event,
bool component_win) { … }
base::Value::Dict CreateResponseDictWithDebugReports(
std::optional<bool> maybe_is_win_report,
std::optional<bool> maybe_component_win) { … }
std::string ToString(
const BiddingAndAuctionResponse::ReportingURLs& reporting) { … }
std::string ToString(const BiddingAndAuctionResponse& response) { … }
auction_worklet::mojom::EventTypePtr CreateReservedEventType(
auction_worklet::mojom::ReservedEventType reserved_event_type) { … }
auction_worklet::mojom::EventTypePtr CreateNonReservedEventType(
const std::string& event_type) { … }
auction_worklet::mojom::PrivateAggregationRequestPtr CreatePaggForEventRequest(
absl::uint128 bucket,
int value,
std::optional<uint64_t> filtering_id,
auction_worklet::mojom::EventTypePtr event) { … }
auction_worklet::mojom::PrivateAggregationRequestPtr CreatePaggHistogramRequest(
absl::uint128 bucket,
int value,
std::optional<uint64_t> filtering_id) { … }
MATCHER_P(EqualsReportingURLS, other, "EqualsReportingURLS") { … }
template <typename... Ts>
auto ElementsAreRequests(Ts&... requests) { … }
MATCHER_P(EqualsBiddingAndAuctionResponse,
other,
"EqualsBiddingAndAuctionResponse(" + ToString(other.get()) + ")") { … }
TEST(BiddingAndAuctionResponseTest, ParseFails) { … }
TEST(BiddingAndAuctionResponseTest, ParseSucceeds) { … }
TEST(BiddingAndAuctionResponseTest, PrivateAggregationDisabled) { … }
class BiddingAndAuctionPAggResponseTest : public testing::Test { … };
TEST_F(BiddingAndAuctionPAggResponseTest, ParsePAggResponse) { … }
TEST_F(BiddingAndAuctionPAggResponseTest, ParsePAggResponseIgnoreErrors) { … }
TEST_F(BiddingAndAuctionPAggResponseTest, ParsePAggResponseContribution) { … }
TEST_F(BiddingAndAuctionPAggResponseTest, ParsePAggResponseComponentWinEvents) { … }
TEST_F(BiddingAndAuctionPAggResponseTest,
ParsePAggResponseServerFilteredEvents) { … }
TEST(BiddingAndAuctionResponseTest, ForDebuggingOnlyReports) { … }
TEST(BiddingAndAuctionResponseTest, ForDebuggingOnlyReportsIgnoreErrors) { … }
TEST(BiddingAndAuctionResponseTest, ForDebuggingOnlyReportsComponentWinner) { … }
TEST(BiddingAndAuctionResponseTest, ForDebuggingOnlyReportsServerFiltered) { … }
TEST(BiddingAndAuctionResponseTest, RemovingFramingSucceeds) { … }
}
}