-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
aggregatable-report-insufficient-budget.sub.https.html
67 lines (59 loc) · 2.07 KB
/
aggregatable-report-insufficient-budget.sub.https.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<meta charset=utf-8>
<meta name=timeout content=long>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<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 host = `https://{{host}}`;
await registerAttributionSrc(t, {
source: {
destination: host,
source_event_id: '123',
aggregation_keys: {
campaignCounts: '0x159',
},
},
method: 'open',
});
const trigger = {
aggregatable_trigger_data: [{
key_piece: '0x400',
source_keys: ['campaignCounts'],
}],
aggregatable_values: {
campaignCounts: 65536,
},
debug_reporting: true,
};
await registerAttributionSrc(t, {
trigger,
});
const payload = await pollAggregatableReports();
assert_equals(payload.reports.length, 1);
const report = JSON.parse(payload.reports[0].body);
assert_own_property(report, 'shared_info');
const shared_info = JSON.parse(report.shared_info);
assert_equals(shared_info.attribution_destination, host);
trigger.aggregatable_values.campaignCounts = 1;
await registerAttributionSrc(t, {
trigger,
cookie: attributionDebugCookie,
});
const debugPayload = await pollVerboseDebugReports();
assert_equals(debugPayload.reports.length, 1);
const debugReport = JSON.parse(debugPayload.reports[0].body);
assert_equals(debugReport.length, 1);
assert_equals(debugReport[0].type, 'trigger-aggregate-insufficient-budget');
assert_own_property(debugReport[0], 'body');
const debugReportBody = debugReport[0].body;
assert_equals(debugReportBody.attribution_destination, host);
assert_equals(debugReportBody.source_event_id, '123');
assert_equals(debugReportBody.source_site, host);
assert_not_own_property(debugReportBody, 'source_debug_key');
assert_not_own_property(debugReportBody, 'trigger_debug_key');
}, 'Aggregatable report is not created due to insufficient budget.');
</script>