Commit 66c9d930 authored by Steve Kobes's avatar Steve Kobes Committed by Commit Bot

Some markdown cleanups in integration_tests/README.md.

Fix reference links and bullet lists to render in md_browser.py, and add
some paragraph breaks for readability.

Bug: 1045064
Change-Id: I48e69df7019a6c43cbb0d44f453fefefd721b9c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063137Reviewed-by: default avatarTom McKee <tommckee@chromium.org>
Commit-Queue: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742860}
parent 3555365b
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
[TOC] [TOC]
## Background ## Background
Chrome's [speed metrics](1) are reported to a number of downstream consumers: Chrome's [speed metrics][csm] are reported to a number of downstream consumers:
- Web Performance APIs (typically through the PerformanceObserver) - Web Performance APIs (typically through the PerformanceObserver)
- UKM (as seen in `chrome://ukm`] - UKM (as seen in `chrome://ukm`]
- UMA (as seen in `chrome://histograms`) - UMA (as seen in `chrome://histograms`)
...@@ -11,38 +12,44 @@ Chrome's [speed metrics](1) are reported to a number of downstream consumers: ...@@ -11,38 +12,44 @@ Chrome's [speed metrics](1) are reported to a number of downstream consumers:
Due to the diverse use cases for and contexts required by each consumer, we 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 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 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 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 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 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 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 we'd like to avoid, so we write integration tests to assert each consumer sees
the correct value. the correct value.
## Metrics Integration Test Framework ## Metrics Integration Test Framework
To make it easier to write tests of metrics emissions, we have the Metrics To make it easier to write tests of metrics emissions, we have the Metrics
Integration Test Framework. The framework makes it easy to Integration Test Framework. The framework makes it easy to
- Run an integration test - Run an integration test
- Load a web page consisting of a given string literal - Load a web page consisting of a given string literal
- Serve resources that can be fetched by the above page - Serve resources that can be fetched by the above page
- Record and verify reports of metrics as they're emitted - Record and verify reports of metrics as they're emitted
- Performance APIs can be queryed in-page and tested with familiar - Performance APIs can be queryed in-page and tested with familiar
testharness.js assertions testharness.js assertions
- UMA metrics can be observed and inspected with a HistogramTester - UMA metrics can be observed and inspected with a HistogramTester
- UKM metrics can be observed and inspected with a TestAutoSetUkmRecorder - UKM metrics can be observed and inspected with a TestAutoSetUkmRecorder
- Trace Events can be queried and aggregated with a TraceAnalyzer - Trace Events can be queried and aggregated with a TraceAnalyzer
## Examples ## Examples
See the [source](metric_browsertest.cc)! See the [source](metric_browsertest.cc)!
## Tips and Tricks ## Tips and Tricks
Use `content::EvalJS`[2] to pass JavaScript values back to C++ and check for Use [`content::EvalJS`][evaljs] to pass JavaScript values back to C++ and check for
consistency. consistency.
Use `xvfb-run`[3] when running the `browser_test` executable Use [`xvfb-run`][xvfb-run] when running the `browser_test` executable.
- no more flashing windows - no more flashing windows
- no chance to accidentally send real input to the test - no chance to accidentally send real input to the test
[1]: https://docs.google.com/document/d/1Ww487ZskJ-xBmJGwPO-XPz_QcJvw-kSNffm0nPhVpj8/edit?usp=sharing [csm]: https://docs.google.com/document/d/1Ww487ZskJ-xBmJGwPO-XPz_QcJvw-kSNffm0nPhVpj8
[2]: /content/public/test/browser_test_utils.h [evaljs]: /content/public/test/browser_test_utils.h
[3]: https://manpages.debian.org/testing/xvfb/xvfb-run.1.en.html [xvfb-run]: https://manpages.debian.org/testing/xvfb/xvfb-run.1.en.html
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment