Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 | 1 year ago | |
---|---|---|
.. | ||
resources | 1 year ago | |
README.md | 1 year ago | |
aggregatable-debug-report.sub.https.html | 1 year ago | |
attributionsrc-request-format.sub.https.html | 1 year ago | |
debug-key.sub.https.html | 1 year ago | |
event-level-debug-report.sub.https.html | 1 year ago | |
event-level-trigger-filter-data.sub.https.html | 1 year ago | |
multiple-event-level-attributions.sub.https.html | 1 year ago | |
simple-aggregatable-report.sub.https.html | 1 year ago | |
simple-event-level-report.sub.https.html | 1 year ago | |
source-priority.sub.https.html | 1 year ago | |
source-registration.sub.https.html | 1 year ago | |
trigger-data-sanitization.sub.https.html | 1 year ago | |
trigger-registration.sub.https.html | 1 year ago |
The primary objective here is to be able to test the Attribution Reporting APIs. This involves testing Event Level Reporting APIs and Aggregatable Reporting APIs. Please refer to the relevant documentation for API details.
wpt_internal/attribution-reporting/
directory. Please note that if tests
are added to a different directory, they could run in parallel, This could
cause issues with shared stash. For this reason, add all Attribution
Reporting tests to this directory only..sub.https.html
to access information like
host
, etc. Please refer to the
Server Features
section in the WPT docs for more details.A set of helper functions are available in resources/helpers.js
for your
convenience. They can be included in tests by adding the following line to your
test. The examples are for Event-Levelt Reporting but the same can be applied
for Aggregatable Reporting.
<script src="resources/helpers.js"></script>
Removes any data from the stash. This is recommended to run at the beginning of your test to ensure you have a fresh stash for your test. You can use this as
// then syntax
resetEventLevelReports().then(callback...);
// await syntax
await resetEventLevelReports();
This works to register a source or a trigger. You just need to pass in the name of the header and the body of the header.
const sourceEvent = {...};
registerAttributionSrc('Attribution-Reporting-Register-Source', sourceEvent);
The wptserve Pipes are used behind the scenes. Pipes are functions that may be used when serving files to alter parts of the response.
A simple delay function that takes time in ms and waits for that long.
// then syntax
delay(100).then(callback...);
// await syntax
await delay(100);
Polls the server for Event-Level Reports or Aggregatable Reports respectively. An interval is accepted which tells the function how much time (in ms) to wait in between requests. The method keeps polling until at least 1 report is returned by the server or the test times out. Please note that receiving reports from the server is a destructive operation on the server-side. This would essentially clear the server of all the reports.
// then syntax
pollEventLevelReports(100).then(callback...);
// await syntax
await pollEventLevelReports(100);
Please refer to the simple-event-level-report-test.sub.https.html
test. It is
a basic test that utilizes helpers for Event-Level reports.
Attribution Reporting APIs add noise to the report content and delay to report
delivery. In order for the tests to run without this noise and delay, chrome
must run with command-line switch --attribution-reporting-debug-mode
. For this reason,
all Attribution Reporting tests are virtual tests. You can run the tests by
# Build WPT
autoninja -C out/Default blink_tests
# Run all Attribution Reporting tests
third_party/blink/tools/run_web_tests.py -t Default virtual/attribution-reporting-debug-mode/wpt_internal/attribution-reporting
# Run a single test
third_party/blink/tools/run_web_tests.py -t Default virtual/attribution-reporting-debug-mode/wpt_internal/attribution-reporting/<test-name>.sub.https.html
All the server code lives in external/wpt/.well-known/attribution-reporting/
directory. This is due to the fact that the browser POSTs the reports to
/.well-known/...
endpoint. The files of interest are
/.well-known/attribution-reporting/report-event-attribution
/.well-known/attribution-reporting/report-aggregate-attribution
These files don’t have a .py
extension but must be treated as python files.
They are registered as python scripts with the WPT server router. You can check
the
tools/serve/serve.py
file for details.
This code handles receiving the reports from the browser and the returning the reports when requested. The server utilizes WPT Python Handlers to achieve this.