Chrome's speed metrics are reported to a number of downstream consumers:
chrome://ukm
]chrome://histograms
)chrome://tracing
)Due to the diverse use cases for and contexts required by each consumer, we can't always guarantee that the calculation of each metric is done entirely in one place.
Further, some consumers must observe distinct values (e.g. privacy and security requirements can mean that a Performance API must see a value based solely on first-party content while a more holistic value can be reported internally).
Because of this, it‘s all too easy to introduce bugs where consumers see incorrect and/or inconsistent values. This is “a bad thing”™ that we’d like to avoid, so we write integration tests to assert each consumer sees the correct value.
To make it easier to write tests of metrics emissions, we have the Metrics Integration Test Framework. The framework makes it easy to
See the source!
Use content::EvalJS
to pass JavaScript values back to C++ and check for consistency.
Use xvfb-run
when running the browser_tests
executable.