Allow running inspector protocol tests using protocol logs
This CL implements a flag called `--inspector-protocol-log` that accepts
a path to a Chrome DevTools Protocol message log. If specified, the test
runner would replay the log mocking the actual browser. The purpose of
this flag is to allow reproducing test flakiness locally and it is not
meant to be used on the bots for now.
Bug: 327140253
Change-Id: I871442d568878b3a1a0d71a18eb2eb721b457e76
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5331573
Reviewed-by: danakj <[email protected]>
Commit-Queue: Alex Rudenko <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1274969}
diff --git a/docs/testing/web_tests.md b/docs/testing/web_tests.md
index db42db94..28baa09b 100644
--- a/docs/testing/web_tests.md
+++ b/docs/testing/web_tests.md
@@ -614,6 +614,27 @@
}
```
+### Reproducing flaky inspector protocol tests
+
+https://crrev.com/c/5318502 implemented logging for inspector-protocol tests.
+With this CL for each test in stderr you should see Chrome DevTools Protocol
+messages that the test and the browser exchanged.
+
+You can use this log to reproduce the failure or timeout locally.
+
+* Prepare a log file and ensure each line contains one protocol message
+in the JSON format. Strip any prefixes or non-protocol messages from the
+original log.
+* Make sure your local test file version matches the version that produced
+the log file.
+* Run the test using the log file:
+
+ ```sh
+ third_party/blink/tools/run_web_tests.py -t Release \
+ --additional-driver-flag="--inspector-protocol-log=/path/to/log.txt" \
+ http/tests/inspector-protocol/network/url-fragment.js
+ ```
+
## Bisecting Regressions
You can use [`git bisect`](https://git-scm.com/docs/git-bisect) to find which