#include "content/browser/attribution_reporting/attribution_host.h"
#include <iterator>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "components/attribution_reporting/data_host.mojom.h"
#include "components/attribution_reporting/registration_eligibility.mojom.h"
#include "components/attribution_reporting/suitable_origin.h"
#include "content/browser/attribution_reporting/attribution_data_host_manager.h"
#include "content/browser/attribution_reporting/attribution_input_event.h"
#include "content/browser/attribution_reporting/attribution_manager.h"
#include "content/browser/attribution_reporting/attribution_suitable_context.h"
#include "content/browser/attribution_reporting/attribution_test_utils.h"
#include "content/browser/attribution_reporting/test/mock_attribution_data_host_manager.h"
#include "content/browser/attribution_reporting/test/mock_attribution_manager.h"
#include "content/browser/storage_partition_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/common/content_features.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_utils.h"
#include "content/test/navigation_simulator_impl.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_web_contents.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/test_support/fake_message_dispatch_context.h"
#include "mojo/public/cpp/test_support/test_utils.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/permissions_policy/origin_with_possible_wildcards.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy_declaration.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/conversions/conversions.mojom.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-shared.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace content {
class AttributionHostTestPeer { … };
namespace {
SuitableOrigin;
_;
AllOf;
Optional;
Property;
Return;
RegistrationEligibility;
const char kConversionUrl[] = …;
constexpr bool kIsForBackgroundRequests = …;
const char kRedirectHeaderData[] = …;
class AttributionHostTest : public RenderViewHostTestHarness { … };
class ScopedAttributionHostTargetFrame { … };
TEST_F(AttributionHostTest, NavigationWithNoImpression_Ignored) { … }
TEST_F(AttributionHostTest, ValidAttributionSrc_ForwardedToManager) { … }
TEST_F(AttributionHostTest, ValidSourceRegistrations_ForwardedToManager) { … }
TEST_F(AttributionHostTest,
ValidAndInvalidSourceRegistrations_ForwardedToManager) { … }
TEST_F(AttributionHostTest, ImpressionInSubframe_Ignored) { … }
TEST_F(AttributionHostTest, ImpressionNavigationWithDeadInitiator_Ignored) { … }
TEST_F(AttributionHostTest,
AttributionSrcNavigationCommitsToErrorPage_Notified) { … }
TEST_F(AttributionHostTest, AttributionSrcNavigationAborts_Notified) { … }
TEST_F(AttributionHostTest,
CommittedOriginDiffersFromConversionDesintation_Notified) { … }
namespace {
const char kLocalHost[] = …;
struct OriginTrustworthyChecksTestCase { … };
const OriginTrustworthyChecksTestCase kOriginTrustworthyChecksTestCases[] = …;
class AttributionHostOriginTrustworthyChecksTest
: public AttributionHostTest,
public ::testing::WithParamInterface<OriginTrustworthyChecksTestCase> { … };
}
TEST_P(AttributionHostOriginTrustworthyChecksTest,
ImpressionNavigation_OriginTrustworthyChecksPerformed) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(AttributionHostTest, DataHost_RegisteredWithContext) { … }
TEST_F(AttributionHostTest, DISABLED_DataHostOnInsecurePage_BadMessage) { … }
TEST_F(AttributionHostTest,
DISABLED_NavigationDataHostOnInsecurePage_BadMessage) { … }
TEST_F(AttributionHostTest, DuplicateAttributionSrcToken_BadMessage) { … }
TEST_F(
AttributionHostTest,
NotifyNavigationWithBackgroundRegistrationsWillStart_DuplicateAttributionSrcToken_BadMessage) { … }
TEST_F(
AttributionHostTest,
NotifyNavigationWithBackgroundRegistrationsWillStart_InsecureContext_Ignored) { … }
TEST_F(AttributionHostTest, DataHostInSubframe_ContextIsOutermostFrame) { … }
TEST_F(AttributionHostTest,
DISABLED_DataHostInSubframeOnInsecurePage_BadMessage) { … }
TEST_F(AttributionHostTest, DataHost_RegisteredWithFencedFrame) { … }
TEST_F(AttributionHostTest, ImpressionNavigation_FeaturePolicyChecked) { … }
TEST_F(AttributionHostTest, RegisterDataHost_FeaturePolicyChecked) { … }
TEST_F(AttributionHostTest, RegisterNavigationDataHost_FeaturePolicyChecked) { … }
TEST_F(
AttributionHostTest,
NotifyNavigationWithBackgroundRegistrationsWillStart_FeaturePolicyChecked) { … }
TEST_F(AttributionHostTest, InsecureTaintTracking) { … }
}
}