Darwin Huang | a8cd3818 | 2019-01-10 11:05:10 | [diff] [blame] | 1 | # Web Tests (formerly known as "Layout Tests" or "LayoutTests") |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 2 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 3 | Web tests are used by Blink to test many components, including but not |
| 4 | limited to layout and rendering. In general, web tests involve loading pages |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 5 | in a test renderer (`content_shell`) and comparing the rendered output or |
| 6 | JavaScript output against an expected output file. |
| 7 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 8 | This document covers running and debugging existing web tests. See the |
| 9 | [Writing Web Tests documentation](./writing_web_tests.md) if you find |
| 10 | yourself writing web tests. |
pwnall | 4ea2eb3 | 2016-11-29 02:47:25 | [diff] [blame] | 11 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 12 | Note that we changed the term "layout tests" to "web tests". |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 13 | Please assume these terms mean the identical stuff. We also call it as |
| 14 | "WebKit tests" and "WebKit layout tests". |
| 15 | |
Matt Falkenhagen | cef0974 | 2020-01-06 05:43:38 | [diff] [blame] | 16 | ["Web platform tests"](./web_platform_tests.md) (WPT) are the preferred form of |
| 17 | web tests and are located at |
| 18 | [web_tests/external/wpt](/third_party/blink/web_tests/external/wpt). |
| 19 | Tests that should work across browsers go there. Other directories are for |
| 20 | Chrome-specific tests only. |
| 21 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 22 | [TOC] |
| 23 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 24 | ## Running Web Tests |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 25 | |
| 26 | ### Initial Setup |
| 27 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 28 | Before you can run the web tests, you need to build the `blink_tests` target |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 29 | to get `content_shell` and all of the other needed binaries. |
| 30 | |
| 31 | ```bash |
kyle Ju | 8f7d38df | 2018-11-26 16:51:22 | [diff] [blame] | 32 | autoninja -C out/Default blink_tests |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 33 | ``` |
| 34 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 35 | On **Android** (web test support |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 36 | [currently limited to KitKat and earlier](https://crbug.com/567947)) you need to |
| 37 | build and install `content_shell_apk` instead. See also: |
| 38 | [Android Build Instructions](../android_build_instructions.md). |
| 39 | |
| 40 | ```bash |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 41 | autoninja -C out/Default content_shell_apk |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 42 | adb install -r out/Default/apks/ContentShell.apk |
| 43 | ``` |
| 44 | |
| 45 | On **Mac**, you probably want to strip the content_shell binary before starting |
| 46 | the tests. If you don't, you'll have 5-10 running concurrently, all stuck being |
| 47 | examined by the OS crash reporter. This may cause other failures like timeouts |
| 48 | where they normally don't occur. |
| 49 | |
| 50 | ```bash |
| 51 | strip ./xcodebuild/{Debug,Release}/content_shell.app/Contents/MacOS/content_shell |
| 52 | ``` |
| 53 | |
| 54 | ### Running the Tests |
| 55 | |
| 56 | TODO: mention `testing/xvfb.py` |
| 57 | |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 58 | The test runner script is in `third_party/blink/tools/run_web_tests.py`. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 59 | |
| 60 | To specify which build directory to use (e.g. out/Default, out/Release, |
| 61 | out/Debug) you should pass the `-t` or `--target` parameter. For example, to |
| 62 | use the build in `out/Default`, use: |
| 63 | |
| 64 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 65 | third_party/blink/tools/run_web_tests.py -t Default |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 66 | ``` |
| 67 | |
| 68 | For Android (if your build directory is `out/android`): |
| 69 | |
| 70 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 71 | third_party/blink/tools/run_web_tests.py -t android --android |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 72 | ``` |
| 73 | |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 74 | *** promo |
| 75 | Windows users need to use `third_party/blink/tools/run_web_tests.bat` instead. |
| 76 | *** |
| 77 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 78 | Tests marked as `[ Skip ]` in |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 79 | [TestExpectations](../../third_party/blink/web_tests/TestExpectations) |
Xianzhu Wang | 15355b2 | 2019-11-02 23:20:02 | [diff] [blame] | 80 | won't be run by default, generally because they cause some intractable tool error. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 81 | To force one of them to be run, either rename that file or specify the skipped |
Xianzhu Wang | 15355b2 | 2019-11-02 23:20:02 | [diff] [blame] | 82 | test on the command line (see below) or in a file specified with --test-list |
| 83 | (however, --skip=always can make the tests marked as `[ Skip ]` always skipped). |
| 84 | Read the [Web Test Expectations documentation](./web_test_expectations.md) to |
| 85 | learn more about TestExpectations and related files. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 86 | |
pwnall | 4ea2eb3 | 2016-11-29 02:47:25 | [diff] [blame] | 87 | *** promo |
| 88 | Currently only the tests listed in |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 89 | [SmokeTests](../../third_party/blink/web_tests/SmokeTests) |
| 90 | are run on the Android bots, since running all web tests takes too long on |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 91 | Android (and may still have some infrastructure issues). Most developers focus |
| 92 | their Blink testing on Linux. We rely on the fact that the Linux and Android |
| 93 | behavior is nearly identical for scenarios outside those covered by the smoke |
| 94 | tests. |
pwnall | 4ea2eb3 | 2016-11-29 02:47:25 | [diff] [blame] | 95 | *** |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 96 | |
| 97 | To run only some of the tests, specify their directories or filenames as |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 98 | arguments to `run_web_tests.py` relative to the web test directory |
| 99 | (`src/third_party/blink/web_tests`). For example, to run the fast form tests, |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 100 | use: |
| 101 | |
| 102 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 103 | third_party/blink/tools/run_web_tests.py fast/forms |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 104 | ``` |
| 105 | |
| 106 | Or you could use the following shorthand: |
| 107 | |
| 108 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 109 | third_party/blink/tools/run_web_tests.py fast/fo\* |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 110 | ``` |
| 111 | |
| 112 | *** promo |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 113 | Example: To run the web tests with a debug build of `content_shell`, but only |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 114 | test the SVG tests and run pixel tests, you would run: |
| 115 | |
| 116 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 117 | third_party/blink/tools/run_web_tests.py -t Default svg |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 118 | ``` |
| 119 | *** |
| 120 | |
| 121 | As a final quick-but-less-robust alternative, you can also just use the |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 122 | content_shell executable to run specific tests by using (example on Windows): |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 123 | |
| 124 | ```bash |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 125 | out/Default/content_shell.exe --run-web-tests <url>|<full_test_source_path>|<relative_test_path> |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 126 | ``` |
| 127 | |
| 128 | as in: |
| 129 | |
| 130 | ```bash |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 131 | out/Default/content_shell.exe --run-web-tests \ |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 132 | c:/chrome/src/third_party/blink/web_tests/fast/forms/001.html |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 133 | ``` |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 134 | or |
| 135 | |
| 136 | ```bash |
| 137 | out/Default/content_shell.exe --run-web-tests fast/forms/001.html |
| 138 | ``` |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 139 | |
| 140 | but this requires a manual diff against expected results, because the shell |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 141 | doesn't do it for you. It also just dumps the text result only (as the dump of |
| 142 | pixels and audio binary data is not human readable). |
Jeonghee Ahn | 2cbb9cb | 2019-09-23 02:52:57 | [diff] [blame] | 143 | See [Running Web Tests Using the Content Shell](./web_tests_in_content_shell.md) |
Xianzhu Wang | 0a37e9d | 2019-03-27 21:27:29 | [diff] [blame] | 144 | for more details of running `content_shell`. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 145 | |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 146 | To see a complete list of arguments supported, run: |
| 147 | |
| 148 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 149 | third_party/blink/tools/run_web_tests.py --help |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 150 | ``` |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 151 | |
| 152 | *** note |
| 153 | **Linux Note:** We try to match the Windows render tree output exactly by |
| 154 | matching font metrics and widget metrics. If there's a difference in the render |
| 155 | tree output, we should see if we can avoid rebaselining by improving our font |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 156 | metrics. For additional information on Linux web tests, please see |
Jeonghee Ahn | 2cbb9cb | 2019-09-23 02:52:57 | [diff] [blame] | 157 | [docs/web_tests_linux.md](./web_tests_linux.md). |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 158 | *** |
| 159 | |
| 160 | *** note |
| 161 | **Mac Note:** While the tests are running, a bunch of Appearance settings are |
| 162 | overridden for you so the right type of scroll bars, colors, etc. are used. |
| 163 | Your main display's "Color Profile" is also changed to make sure color |
| 164 | correction by ColorSync matches what is expected in the pixel tests. The change |
| 165 | is noticeable, how much depends on the normal level of correction for your |
| 166 | display. The tests do their best to restore your setting when done, but if |
| 167 | you're left in the wrong state, you can manually reset it by going to |
| 168 | System Preferences → Displays → Color and selecting the "right" value. |
| 169 | *** |
| 170 | |
| 171 | ### Test Harness Options |
| 172 | |
| 173 | This script has a lot of command line flags. You can pass `--help` to the script |
| 174 | to see a full list of options. A few of the most useful options are below: |
| 175 | |
| 176 | | Option | Meaning | |
| 177 | |:----------------------------|:--------------------------------------------------| |
| 178 | | `--debug` | Run the debug build of the test shell (default is release). Equivalent to `-t Debug` | |
| 179 | | `--nocheck-sys-deps` | Don't check system dependencies; this allows faster iteration. | |
| 180 | | `--verbose` | Produce more verbose output, including a list of tests that pass. | |
Xianzhu Wang | cacba48 | 2017-06-05 18:46:43 | [diff] [blame] | 181 | | `--reset-results` | Overwrite the current baselines (`-expected.{png|txt|wav}` files) with actual results, or create new baselines if there are no existing baselines. | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 182 | | `--renderer-startup-dialog` | Bring up a modal dialog before running the test, useful for attaching a debugger. | |
Quinten Yearsley | 17bf9b43 | 2018-01-02 22:02:45 | [diff] [blame] | 183 | | `--fully-parallel` | Run tests in parallel using as many child processes as the system has cores. | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 184 | | `--driver-logging` | Print C++ logs (LOG(WARNING), etc). | |
| 185 | |
| 186 | ## Success and Failure |
| 187 | |
| 188 | A test succeeds when its output matches the pre-defined expected results. If any |
| 189 | tests fail, the test script will place the actual generated results, along with |
| 190 | a diff of the actual and expected results, into |
| 191 | `src/out/Default/layout_test_results/`, and by default launch a browser with a |
| 192 | summary and link to the results/diffs. |
| 193 | |
| 194 | The expected results for tests are in the |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 195 | `src/third_party/blink/web_tests/platform` or alongside their respective |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 196 | tests. |
| 197 | |
| 198 | *** note |
| 199 | Tests which use [testharness.js](https://github.com/w3c/testharness.js/) |
| 200 | do not have expected result files if all test cases pass. |
| 201 | *** |
| 202 | |
| 203 | A test that runs but produces the wrong output is marked as "failed", one that |
| 204 | causes the test shell to crash is marked as "crashed", and one that takes longer |
| 205 | than a certain amount of time to complete is aborted and marked as "timed out". |
| 206 | A row of dots in the script's output indicates one or more tests that passed. |
| 207 | |
| 208 | ## Test expectations |
| 209 | |
| 210 | The |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 211 | [TestExpectations](../../third_party/blink/web_tests/TestExpectations) file (and related |
| 212 | files) contains the list of all known web test failures. See the |
| 213 | [Web Test Expectations documentation](./web_test_expectations.md) for more |
pwnall | 4ea2eb3 | 2016-11-29 02:47:25 | [diff] [blame] | 214 | on this. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 215 | |
| 216 | ## Testing Runtime Flags |
| 217 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 218 | There are two ways to run web tests with additional command-line arguments: |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 219 | |
Xianzhu Wang | adb0670a2 | 2020-07-16 23:04:58 | [diff] [blame^] | 220 | * Using `--additional-driver-flag` or `--flag-specific`: |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 221 | |
| 222 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 223 | third_party/blink/tools/run_web_tests.py --additional-driver-flag=--blocking-repaint |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 224 | ``` |
| 225 | |
| 226 | This tells the test harness to pass `--blocking-repaint` to the |
| 227 | content_shell binary. |
| 228 | |
| 229 | It will also look for flag-specific expectations in |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 230 | `web_tests/FlagExpectations/blocking-repaint`, if this file exists. The |
Xianzhu Wang | 72fb2021 | 2020-05-05 03:39:13 | [diff] [blame] | 231 | suppressions in this file override the main TestExpectations files. |
| 232 | However, `[ Slow ]` in either flag-specific expectations or base expectations |
| 233 | is always merged into the used expectations. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 234 | |
Xianzhu Wang | 15355b2 | 2019-11-02 23:20:02 | [diff] [blame] | 235 | It will also look for baselines in `web_tests/flag-specific/blocking-repaint`. |
| 236 | The baselines in this directory override the fallback baselines. |
| 237 | |
| 238 | By default, name of the expectation file name under |
| 239 | `web_tests/FlagExpectations` and name of the baseline directory under |
| 240 | `web_tests/flag-specific` uses the first flag of --additional-driver-flag |
| 241 | with leading '-'s stripped. |
| 242 | |
| 243 | You can also customize the name in `web_tests/FlagSpecificConfig` when |
| 244 | the name is too long or when we need to match multiple additional args: |
| 245 | |
| 246 | ```json |
| 247 | { |
| 248 | "name": "short-name", |
| 249 | "args": ["--blocking-repaint", "--another-flag"] |
| 250 | } |
| 251 | ``` |
| 252 | |
| 253 | When at least `--additional-driver-flag=--blocking-repaint` and |
| 254 | `--additional-driver-flag=--another-flag` are specified, `short-name` will |
| 255 | be used as name of the flag specific expectation file and the baseline directory. |
| 256 | |
| 257 | With the config, you can also use `--flag-specific=short-name` as a shortcut |
| 258 | of `--additional-driver-flag=--blocking-repaint --additional-driver-flag=--another-flag`. |
| 259 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 260 | * Using a *virtual test suite* defined in |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 261 | [web_tests/VirtualTestSuites](../../third_party/blink/web_tests/VirtualTestSuites). |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 262 | A virtual test suite runs a subset of web tests with additional flags, with |
| 263 | `virtual/<prefix>/...` in their paths. The tests can be virtual tests that |
| 264 | map to real base tests (directories or files) whose paths match any of the |
| 265 | specified bases, or any real tests under `web_tests/virtual/<prefix>/` |
| 266 | directory. For example, you could test a (hypothetical) new mode for |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 267 | repainting using the following virtual test suite: |
| 268 | |
| 269 | ```json |
| 270 | { |
| 271 | "prefix": "blocking_repaint", |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 272 | "bases": ["compositing", "fast/repaint"], |
| 273 | "args": ["--blocking-repaint"] |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 274 | } |
| 275 | ``` |
| 276 | |
| 277 | This will create new "virtual" tests of the form |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 278 | `virtual/blocking_repaint/compositing/...` and |
Robert Ma | 89dd91d83 | 2017-08-02 18:08:44 | [diff] [blame] | 279 | `virtual/blocking_repaint/fast/repaint/...` which correspond to the files |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 280 | under `web_tests/compositing` and `web_tests/fast/repaint`, respectively, |
| 281 | and pass `--blocking-repaint` to `content_shell` when they are run. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 282 | |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 283 | These virtual tests exist in addition to the original `compositing/...` and |
| 284 | `fast/repaint/...` tests. They can have their own expectations in |
| 285 | `web_tests/TestExpectations`, and their own baselines. The test harness will |
Xianzhu Wang | 72fb2021 | 2020-05-05 03:39:13 | [diff] [blame] | 286 | use the non-virtual expectations and baselines as a fallback. If a virtual |
| 287 | test has its own expectations, they will override all non-virtual |
| 288 | expectations. otherwise the non-virtual expectations will be used. However, |
| 289 | `[ Slow ]` in either virtual or non-virtual expectations is always merged |
| 290 | into the used expectations. If a virtual test is expected to pass while the |
| 291 | non-virtual test is expected to fail, you need to add an explicit `[ Pass ]` |
| 292 | entry for the virtual test. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 293 | |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 294 | This will also let any real tests under `web_tests/virtual/blocking_repaint` |
| 295 | directory run with the `--blocking-repaint` flag. |
| 296 | |
| 297 | The "prefix" value should be unique. Multiple directories with the same flags |
| 298 | should be listed in the same "bases" list. The "bases" list can be empty, |
| 299 | in case that we just want to run the real tests under `virtual/<prefix>` |
| 300 | with the flags without creating any virtual tests. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 301 | |
| 302 | For flags whose implementation is still in progress, virtual test suites and |
Xianzhu Wang | adb0670a2 | 2020-07-16 23:04:58 | [diff] [blame^] | 303 | flag-specific expectations represent two alternative strategies for testing both |
| 304 | the enabled code path and not-enabled code path. They are preferred to only |
| 305 | setting a [runtime enabled feature](../../third_party/blink/renderer/platform/RuntimeEnabledFeatures.md) |
| 306 | to `status: "test"` if the feature has substantially different code path from |
| 307 | production because the latter would cause loss of test coverage of the production |
| 308 | code path. |
| 309 | |
| 310 | Consider the following when choosing between virtual test suites and |
| 311 | flag-specific expectations: |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 312 | |
| 313 | * The |
| 314 | [waterfall builders](https://dev.chromium.org/developers/testing/chromium-build-infrastructure/tour-of-the-chromium-buildbot) |
| 315 | and [try bots](https://dev.chromium.org/developers/testing/try-server-usage) |
| 316 | will run all virtual test suites in addition to the non-virtual tests. |
| 317 | Conversely, a flag-specific expectations file won't automatically cause the |
| 318 | bots to test your flag - if you want bot coverage without virtual test suites, |
Xianzhu Wang | adb0670a2 | 2020-07-16 23:04:58 | [diff] [blame^] | 319 | you will need to set up a dedicated bot ([example](https://chromium-review.googlesource.com/c/chromium/src/+/1850255)) |
| 320 | for your flag. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 321 | |
| 322 | * Due to the above, virtual test suites incur a performance penalty for the |
| 323 | commit queue and the continuous build infrastructure. This is exacerbated by |
| 324 | the need to restart `content_shell` whenever flags change, which limits |
| 325 | parallelism. Therefore, you should avoid adding large numbers of virtual test |
| 326 | suites. They are well suited to running a subset of tests that are directly |
| 327 | related to the feature, but they don't scale to flags that make deep |
| 328 | architectural changes that potentially impact all of the tests. |
| 329 | |
Jeff Carpenter | 489d402 | 2018-05-15 00:23:00 | [diff] [blame] | 330 | * Note that using wildcards in virtual test path names (e.g. |
Xianzhu Wang | 5d682c8 | 2019-10-29 05:08:19 | [diff] [blame] | 331 | `virtual/blocking_repaint/fast/repaint/*`) is not supported, but you can |
| 332 | still use `virtual/blocking_repaint` to run all real and virtual tests |
| 333 | in the suite or `virtual/blocking_repaint/fast/repaint/dir` to run real |
| 334 | or virtual tests in the suite under a specific directory. |
Jeff Carpenter | 489d402 | 2018-05-15 00:23:00 | [diff] [blame] | 335 | |
Xianzhu Wang | a617a14 | 2020-05-07 21:57:47 | [diff] [blame] | 336 | *** note |
| 337 | We can run a virtual test with additional flags. Both the virtual args and the |
| 338 | additional flags will be applied. The fallback order of baselines and |
| 339 | expectations will be: 1) flag-specific virtual, 2) non-flag-specific virtual, |
| 340 | 3) flag-specific base, 4) non-flag-specific base |
| 341 | *** |
| 342 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 343 | ## Tracking Test Failures |
| 344 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 345 | All bugs, associated with web test failures must have the |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 346 | [Test-Layout](https://crbug.com/?q=label:Test-Layout) label. Depending on how |
| 347 | much you know about the bug, assign the status accordingly: |
| 348 | |
| 349 | * **Unconfirmed** -- You aren't sure if this is a simple rebaseline, possible |
| 350 | duplicate of an existing bug, or a real failure |
| 351 | * **Untriaged** -- Confirmed but unsure of priority or root cause. |
| 352 | * **Available** -- You know the root cause of the issue. |
| 353 | * **Assigned** or **Started** -- You will fix this issue. |
| 354 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 355 | When creating a new web test bug, please set the following properties: |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 356 | |
| 357 | * Components: a sub-component of Blink |
| 358 | * OS: **All** (or whichever OS the failure is on) |
| 359 | * Priority: 2 (1 if it's a crash) |
| 360 | * Type: **Bug** |
| 361 | * Labels: **Test-Layout** |
| 362 | |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 363 | You can also use the _Layout Test Failure_ template, which pre-sets these |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 364 | labels for you. |
| 365 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 366 | ## Debugging Web Tests |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 367 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 368 | After the web tests run, you should get a summary of tests that pass or |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 369 | fail. If something fails unexpectedly (a new regression), you will get a |
| 370 | `content_shell` window with a summary of the unexpected failures. Or you might |
| 371 | have a failing test in mind to investigate. In any case, here are some steps and |
| 372 | tips for finding the problem. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 373 | |
| 374 | * Take a look at the result. Sometimes tests just need to be rebaselined (see |
| 375 | below) to account for changes introduced in your patch. |
| 376 | * Load the test into a trunk Chrome or content_shell build and look at its |
| 377 | result. (For tests in the http/ directory, start the http server first. |
| 378 | See above. Navigate to `http://localhost:8000/` and proceed from there.) |
| 379 | The best tests describe what they're looking for, but not all do, and |
| 380 | sometimes things they're not explicitly testing are still broken. Compare |
| 381 | it to Safari, Firefox, and IE if necessary to see if it's correct. If |
| 382 | you're still not sure, find the person who knows the most about it and |
| 383 | ask. |
| 384 | * Some tests only work properly in content_shell, not Chrome, because they |
| 385 | rely on extra APIs exposed there. |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 386 | * Some tests only work properly when they're run in the web-test |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 387 | framework, not when they're loaded into content_shell directly. The test |
| 388 | should mention that in its visible text, but not all do. So try that too. |
| 389 | See "Running the tests", above. |
| 390 | * If you think the test is correct, confirm your suspicion by looking at the |
| 391 | diffs between the expected result and the actual one. |
| 392 | * Make sure that the diffs reported aren't important. Small differences in |
| 393 | spacing or box sizes are often unimportant, especially around fonts and |
| 394 | form controls. Differences in wording of JS error messages are also |
| 395 | usually acceptable. |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 396 | * `third_party/blink/tools/run_web_tests.py path/to/your/test.html` produces |
| 397 | a page listing all test results. Those which fail their expectations will |
| 398 | include links to the expected result, actual result, and diff. These |
| 399 | results are saved to `$root_build_dir/layout-test-results`. |
jonross | 2618570 | 2019-04-08 18:54:10 | [diff] [blame] | 400 | * Alternatively the `--results-directory=path/for/output/` option allows |
| 401 | you to specify an alternative directory for the output to be saved to. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 402 | * If you're still sure it's correct, rebaseline the test (see below). |
| 403 | Otherwise... |
| 404 | * If you're lucky, your test is one that runs properly when you navigate to it |
| 405 | in content_shell normally. In that case, build the Debug content_shell |
| 406 | project, fire it up in your favorite debugger, and load the test file either |
qyearsley | 23599b7 | 2017-02-16 19:10:42 | [diff] [blame] | 407 | from a `file:` URL. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 408 | * You'll probably be starting and stopping the content_shell a lot. In VS, |
| 409 | to save navigating to the test every time, you can set the URL to your |
qyearsley | 23599b7 | 2017-02-16 19:10:42 | [diff] [blame] | 410 | test (`file:` or `http:`) as the command argument in the Debugging section of |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 411 | the content_shell project Properties. |
| 412 | * If your test contains a JS call, DOM manipulation, or other distinctive |
| 413 | piece of code that you think is failing, search for that in the Chrome |
| 414 | solution. That's a good place to put a starting breakpoint to start |
| 415 | tracking down the issue. |
| 416 | * Otherwise, you're running in a standard message loop just like in Chrome. |
| 417 | If you have no other information, set a breakpoint on page load. |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 418 | * If your test only works in full web-test mode, or if you find it simpler to |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 419 | debug without all the overhead of an interactive session, start the |
Kent Tamura | cd3ebc4 | 2018-05-16 06:44:22 | [diff] [blame] | 420 | content_shell with the command-line flag `--run-web-tests`, followed by the |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 421 | URL (`file:` or `http:`) to your test. More information about running web tests |
| 422 | in content_shell can be found [here](./web_tests_in_content_shell.md). |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 423 | * In VS, you can do this in the Debugging section of the content_shell |
| 424 | project Properties. |
| 425 | * Now you're running with exactly the same API, theme, and other setup that |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 426 | the web tests use. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 427 | * Again, if your test contains a JS call, DOM manipulation, or other |
| 428 | distinctive piece of code that you think is failing, search for that in |
| 429 | the Chrome solution. That's a good place to put a starting breakpoint to |
| 430 | start tracking down the issue. |
| 431 | * If you can't find any better place to set a breakpoint, start at the |
| 432 | `TestShell::RunFileTest()` call in `content_shell_main.cc`, or at |
| 433 | `shell->LoadURL() within RunFileTest()` in `content_shell_win.cc`. |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 434 | * Debug as usual. Once you've gotten this far, the failing web test is just a |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 435 | (hopefully) reduced test case that exposes a problem. |
| 436 | |
| 437 | ### Debugging HTTP Tests |
| 438 | |
| 439 | To run the server manually to reproduce/debug a failure: |
| 440 | |
| 441 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 442 | third_party/blink/tools/run_blink_httpd.py |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 443 | ``` |
| 444 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 445 | The web tests are served from `http://127.0.0.1:8000/`. For example, to |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 446 | run the test |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 447 | `web_tests/http/tests/serviceworker/chromium/service-worker-allowed.html`, |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 448 | navigate to |
| 449 | `http://127.0.0.1:8000/serviceworker/chromium/service-worker-allowed.html`. Some |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 450 | tests behave differently if you go to `127.0.0.1` vs. `localhost`, so use |
| 451 | `127.0.0.1`. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 452 | |
Kent Tamura | e81dbff | 2018-04-20 17:35:34 | [diff] [blame] | 453 | To kill the server, hit any key on the terminal where `run_blink_httpd.py` is |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 454 | running, use `taskkill` or the Task Manager on Windows, or `killall` or |
| 455 | Activity Monitor on macOS. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 456 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 457 | The test server sets up an alias to the `web_tests/resources` directory. For |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 458 | example, in HTTP tests, you can access the testing framework using |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 459 | `src="/js-test-resources/js-test.js"`. |
| 460 | |
| 461 | ### Tips |
| 462 | |
| 463 | Check https://test-results.appspot.com/ to see how a test did in the most recent |
| 464 | ~100 builds on each builder (as long as the page is being updated regularly). |
| 465 | |
| 466 | A timeout will often also be a text mismatch, since the wrapper script kills the |
| 467 | content_shell before it has a chance to finish. The exception is if the test |
| 468 | finishes loading properly, but somehow hangs before it outputs the bit of text |
| 469 | that tells the wrapper it's done. |
| 470 | |
| 471 | Why might a test fail (or crash, or timeout) on buildbot, but pass on your local |
| 472 | machine? |
| 473 | * If the test finishes locally but is slow, more than 10 seconds or so, that |
| 474 | would be why it's called a timeout on the bot. |
| 475 | * Otherwise, try running it as part of a set of tests; it's possible that a test |
| 476 | one or two (or ten) before this one is corrupting something that makes this |
| 477 | one fail. |
| 478 | * If it consistently works locally, make sure your environment looks like the |
| 479 | one on the bot (look at the top of the stdio for the webkit_tests step to see |
| 480 | all the environment variables and so on). |
| 481 | * If none of that helps, and you have access to the bot itself, you may have to |
| 482 | log in there and see if you can reproduce the problem manually. |
| 483 | |
Will Chen | 22b48850 | 2017-11-30 21:37:15 | [diff] [blame] | 484 | ### Debugging DevTools Tests |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 485 | |
Will Chen | 22b48850 | 2017-11-30 21:37:15 | [diff] [blame] | 486 | * Do one of the following: |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 487 | * Option A) Run from the `chromium/src` folder: |
Tim van der Lippe | ae60643 | 2020-06-03 15:30:25 | [diff] [blame] | 488 | `third_party/blink/tools/run_web_tests.py --additional-driver-flag='--remote-debugging-port=9222' --additional-driver-flag='--debug-devtools' --time-out-ms=6000000` |
Will Chen | 22b48850 | 2017-11-30 21:37:15 | [diff] [blame] | 489 | * Option B) If you need to debug an http/tests/inspector test, start httpd |
| 490 | as described above. Then, run content_shell: |
Tim van der Lippe | ae60643 | 2020-06-03 15:30:25 | [diff] [blame] | 491 | `out/Default/content_shell --remote-debugging-port=9222 --additional-driver-flag='--debug-devtools' --run-web-tests http://127.0.0.1:8000/path/to/test.html` |
Will Chen | 22b48850 | 2017-11-30 21:37:15 | [diff] [blame] | 492 | * Open `http://localhost:9222` in a stable/beta/canary Chrome, click the single |
| 493 | link to open the devtools with the test loaded. |
| 494 | * In the loaded devtools, set any required breakpoints and execute `test()` in |
| 495 | the console to actually start the test. |
| 496 | |
| 497 | NOTE: If the test is an html file, this means it's a legacy test so you need to add: |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 498 | * Add `window.debugTest = true;` to your test code as follows: |
| 499 | |
| 500 | ```javascript |
| 501 | window.debugTest = true; |
| 502 | function test() { |
| 503 | /* TEST CODE */ |
| 504 | } |
Kim Paulhamus | 61d60c3 | 2018-02-09 18:03:49 | [diff] [blame] | 505 | ``` |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 506 | |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 507 | ## Bisecting Regressions |
| 508 | |
| 509 | You can use [`git bisect`](https://git-scm.com/docs/git-bisect) to find which |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 510 | commit broke (or fixed!) a web test in a fully automated way. Unlike |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 511 | [bisect-builds.py](http://dev.chromium.org/developers/bisect-builds-py), which |
| 512 | downloads pre-built Chromium binaries, `git bisect` operates on your local |
| 513 | checkout, so it can run tests with `content_shell`. |
| 514 | |
| 515 | Bisecting can take several hours, but since it is fully automated you can leave |
| 516 | it running overnight and view the results the next day. |
| 517 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 518 | To set up an automated bisect of a web test regression, create a script like |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 519 | this: |
| 520 | |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 521 | ```bash |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 522 | #!/bin/bash |
| 523 | |
| 524 | # Exit code 125 tells git bisect to skip the revision. |
| 525 | gclient sync || exit 125 |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 526 | autoninja -C out/Debug -j100 blink_tests || exit 125 |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 527 | |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 528 | third_party/blink/tools/run_web_tests.py -t Debug \ |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 529 | --no-show-results --no-retry-failures \ |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 530 | path/to/web/test.html |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 531 | ``` |
| 532 | |
| 533 | Modify the `out` directory, ninja args, and test name as appropriate, and save |
| 534 | the script in `~/checkrev.sh`. Then run: |
| 535 | |
Mathias Bynens | 172fc6b | 2018-09-05 09:39:43 | [diff] [blame] | 536 | ```bash |
Steve Kobes | e123a3d4 | 2017-07-20 01:20:30 | [diff] [blame] | 537 | chmod u+x ~/checkrev.sh # mark script as executable |
| 538 | git bisect start <badrev> <goodrev> |
| 539 | git bisect run ~/checkrev.sh |
| 540 | git bisect reset # quit the bisect session |
| 541 | ``` |
| 542 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 543 | ## Rebaselining Web Tests |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 544 | |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 545 | *** promo |
| 546 | To automatically re-baseline tests across all Chromium platforms, using the |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 547 | buildbot results, see [How to rebaseline](./web_test_expectations.md#How-to-rebaseline). |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 548 | Alternatively, to manually run and test and rebaseline it on your workstation, |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 549 | read on. |
| 550 | *** |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 551 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 552 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 553 | third_party/blink/tools/run_web_tests.py --reset-results foo/bar/test.html |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 554 | ``` |
| 555 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 556 | If there are current expectation files for `web_tests/foo/bar/test.html`, |
Xianzhu Wang | cacba48 | 2017-06-05 18:46:43 | [diff] [blame] | 557 | the above command will overwrite the current baselines at their original |
| 558 | locations with the actual results. The current baseline means the `-expected.*` |
| 559 | file used to compare the actual result when the test is run locally, i.e. the |
Darwin Huang | a8cd3818 | 2019-01-10 11:05:10 | [diff] [blame] | 560 | first file found in the [baseline search path](https://cs.chromium.org/search/?q=port/base.py+baseline_search_path). |
Xianzhu Wang | cacba48 | 2017-06-05 18:46:43 | [diff] [blame] | 561 | |
| 562 | If there are no current baselines, the above command will create new baselines |
| 563 | in the platform-independent directory, e.g. |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 564 | `web_tests/foo/bar/test-expected.{txt,png}`. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 565 | |
| 566 | When you rebaseline a test, make sure your commit description explains why the |
Xianzhu Wang | cacba48 | 2017-06-05 18:46:43 | [diff] [blame] | 567 | test is being re-baselined. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 568 | |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 569 | ### Rebaselining flag-specific expectations |
| 570 | |
| 571 | Though we prefer the Rebaseline Tool to local rebaselining, the Rebaseline Tool |
| 572 | doesn't support rebaselining flag-specific expectations. |
| 573 | |
| 574 | ```bash |
Robert Ma | 7ed1679 | 2020-06-16 16:38:52 | [diff] [blame] | 575 | third_party/blink/tools/run_web_tests.py --additional-driver-flag=--enable-flag --reset-results foo/bar/test.html |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 576 | ``` |
Xianzhu Wang | 525fcbc | 2020-06-04 22:49:46 | [diff] [blame] | 577 | *** promo |
| 578 | You can use `--flag-specific=config` as a shorthand of |
| 579 | `--additional-driver-flag=--enable-flag` if `config` is defined in |
| 580 | `web_tests/FlagSpecificConfig`. |
| 581 | *** |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 582 | |
| 583 | New baselines will be created in the flag-specific baselines directory, e.g. |
Xianzhu Wang | 525fcbc | 2020-06-04 22:49:46 | [diff] [blame] | 584 | `web_tests/flag-specific/enable-flag/foo/bar/test-expected.{txt,png}` |
| 585 | or |
| 586 | `web_tests/flag-specific/config/foo/bar/test-expected.{txt,png}` |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 587 | |
| 588 | Then you can commit the new baselines and upload the patch for review. |
| 589 | |
| 590 | However, it's difficult for reviewers to review the patch containing only new |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 591 | files. You can follow the steps below for easier review. |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 592 | |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 593 | 1. Copy existing baselines to the flag-specific baselines directory for the |
| 594 | tests to be rebaselined: |
| 595 | ```bash |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 596 | third_party/blink/tools/run_web_tests.py --additional-driver-flag=--enable-flag --copy-baselines foo/bar/test.html |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 597 | ``` |
| 598 | Then add the newly created baseline files, commit and upload the patch. |
| 599 | Note that the above command won't copy baselines for passing tests. |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 600 | |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 601 | 2. Rebaseline the test locally: |
| 602 | ```bash |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 603 | third_party/blink/tools/run_web_tests.py --additional-driver-flag=--enable-flag --reset-results foo/bar/test.html |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 604 | ``` |
| 605 | Commit the changes and upload the patch. |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 606 | |
Xianzhu Wang | d063968e | 2017-10-16 16:47:44 | [diff] [blame] | 607 | 3. Request review of the CL and tell the reviewer to compare the patch sets that |
| 608 | were uploaded in step 1 and step 2 to see the differences of the rebaselines. |
Xianzhu Wang | 95d0bac3 | 2017-06-05 21:09:39 | [diff] [blame] | 609 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 610 | ## Known Issues |
| 611 | |
| 612 | See |
| 613 | [bugs with the component Blink>Infra](https://bugs.chromium.org/p/chromium/issues/list?can=2&q=component%3ABlink%3EInfra) |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 614 | for issues related to Blink tools, include the web test runner. |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 615 | |
pwnall | ae101a5f | 2016-11-08 00:24:38 | [diff] [blame] | 616 | * If QuickTime is not installed, the plugin tests |
| 617 | `fast/dom/object-embed-plugin-scripting.html` and |
| 618 | `plugins/embed-attributes-setting.html` are expected to fail. |