Example: the blink_platform_unittests
& blink_unittests
(previously webkit_unit_tests
) targets:
./out/Debug/blink_unittests --gtest_filter="HTMLPreloadScannerDocumentTest.XHRResponseDocument"
./out/Debug/blink_platform_unittests --gtest_filter="ResourceFetcherTest.UseExistingResource"
./out/Debug/blink_platform_unittests --gtest_filter="ResourceFetcherTest.*"
Useful gtest flags:
--test-timeout=100000000 --test-launcher-timeout=1000000
--test-launcher-retry-limit=0
--gtest_filter="POSITIVE_PATTERNS:AND_MORE[-NEGATIVE_PATTERNS:AND_MORE]"
--gtest_filter="ResourceFetcherTest.*-ResourceFetcherTest.StartLoadAfterFrameDetach:ResourceFetcherTest.Vary"
Running a non-unit-test from a remote device over SSH will likely result in the test
failing due to display issues. This requires running export DISPLAY=:20
to fix.
Browser test tips: https://chromium.googlesource.com/chromium/src/+/master/content/public/test/README.md.
RuntimeEnabledFeatures
Runtime enable features have automatically-generated Scope*
classes to help
enable features for unit tests. See
https://source.chromium.org/search?q=Scoped.*ForTest%20file:test.cc%20file:blink&sq=
for example.
Misc useful links:
promise_test
s run sequentially,
how to use t.step_func()
, or the difference between add_result_callback()
and
add_completion_callback()
. Also it is not super easy to find for some reason I thinkhttps
tests working locallyRunning layout tests:
third_party/blink/tools/run_web_tests.py -t Debug http/tests/security/referrer-policy-conflicting-policies.html external/wpt/workers
Useful flags:
--no-retry-failures
--fully-parallel
The last set of test results are always available at:
./out/Debug/layout-test-results/results.html
Python server output can be found at:
./out/<Dir>/layout-test-results/wptserve_stdout.txt
./out/<Dir>/layout-test-results/wptserve_stderr.txt
run_web_tests.py
flags--driver-logging
--additional-driver-flag=--no-sandbox
--timeout-ms=100000000
If you want to use a cross-origin in a test, you have two options:
test-name.sub.html
or test-name.sub.https.html
http://:/html/
http://:/html/
get-host-info
helper
<script src="/common/get-host-info.sub.js"></script>
URL(get_host_info().HTTPS_REMOTE_ORIGIN + '/worklets/resources/referrer-checker.py');
Sometimes you have to test Chrome’s behavior on public and private networks. See the following resources for doing so:
Here’s an example:
./out/Debug/chrome --no-sandbox --enable-experimental-web-platform-features --enable-features=FencedFrames,SharedStorageAPI --ip-address-space-overrides=127.0.0.1:8445=private,127.0.0.1:8446=public https://fenced-frames.glitch.me/
/element-timing/resources/progressive-image.py
. You can
see it being used in the following CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2138994/3/third_party/blink/web_tests/external/wpt/preload/subresource-integrity-partial-image.html#25
.