123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <!doctype html>
- <meta charset=utf-8>
- <meta name=timeout content=long>
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
- <script src="resources/helpers.js"></script>
- <script>
- attribution_reporting_promise_test(async t => {
- const source = {
- destination: `https://{{host}}`,
- aggregation_keys: {
- campaignCounts: "0x159",
- geoValue: "0x5",
- }
- };
- const trigger = {
- aggregatable_trigger_data: [
- {
- key_piece: '0x400',
- source_keys: ['campaignCounts'],
- },
- {
- key_piece: '0xA80',
- source_keys: ['geoValue', 'nonMatchingKey'],
- }
- ],
- aggregatable_values: {
- campaignCounts: 32768,
- geoValue: 1664,
- },
- };
- await registerAttributionSrc(t, {source, cookie: 'foo=bar;Secure;HttpOnly;Path=/'});
- await registerAttributionSrc(t, {trigger});
- const payload = await pollAggregatableReports();
- assert_equals(payload.reports.length, 1);
- const report = JSON.parse(payload.reports[0].body);
- const headers = payload.reports[0].headers;
- assert_own_property(report, 'shared_info');
- const shared_info = JSON.parse(report.shared_info);
- assert_own_property(shared_info, 'api');
- assert_equals(shared_info.api, 'attribution-reporting');
- assert_own_property(shared_info, 'report_id');
- assert_own_property(shared_info, 'reporting_origin');
- assert_own_property(shared_info, 'scheduled_report_time');
- assert_own_property(shared_info, 'version');
- assert_own_property(shared_info, 'attribution_destination');
- assert_equals(shared_info.attribution_destination, source.destination);
- assert_not_own_property(report, 'source_debug_key');
- assert_not_own_property(report, 'trigger_debug_key');
- assert_own_property(report, 'aggregation_service_payloads');
- assert_equals(report.aggregation_service_payloads.length, 1);
- const aggregation_service_payload = report.aggregation_service_payloads[0];
- assert_own_property(aggregation_service_payload, 'payload');
- assert_own_property(aggregation_service_payload, 'key_id');
- assert_not_own_property(aggregation_service_payload, 'debug_cleartext_payload');
- validateReportHeaders(headers);
- }, 'Ensure aggregatable attribution report is received.');
- </script>
|