chromium/third_party/blink/web_tests/wpt_internal/attribution-reporting/multi-registration.sub.https.html

<!doctype html>
<meta charset=utf-8>
<meta name=timeout content=long>
<script src="/common/get-host-info.sub.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/attribution-reporting/resources/helpers.js"></script>
<body>
<script>
attribution_reporting_promise_test(async t => {
  const otherReportingOrigin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN;

  registerAttributionSrcByImg([
    createRedirectChain([
      {
        source: {
          destination: 'https://{{host}}',
          source_event_id: '1',
        },
      },
      {
        trigger: {
          event_trigger_data: [{trigger_data: '0'}],
        },
      },
    ]),
    createRedirectChain([
      {
        reportingOrigin: otherReportingOrigin,
        source: {
          destination: 'https://{{host}}',
          source_event_id: '2',
        },
      },
      {
        reportingOrigin: otherReportingOrigin,
        trigger: {
          event_trigger_data: [{trigger_data: '1'}],
        },
      },
    ]),
  ].join(' '));

  {
    const payload = await pollEventLevelReports();
    assert_equals(payload.reports.length, 1);
    const report = JSON.parse(payload.reports[0].body);
    assert_equals(report.source_event_id, '1');
    assert_equals(report.trigger_data, '0');
  }

  {
    const payload = await pollEventLevelReports(otherReportingOrigin);
    assert_equals(payload.reports.length, 1);
    const report = JSON.parse(payload.reports[0].body);
    assert_equals(report.source_event_id, '2');
    assert_equals(report.trigger_data, '1');
  }
}, 'Multi-registration succeeds.');
</script>