Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame^] | 1 | # Running web tests using the content shell |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 2 | |
| 3 | ## Basic usage |
| 4 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame^] | 5 | Web tests can be run with `content_shell`. To just dump the render tree, use |
Kent Tamura | cd3ebc4 | 2018-05-16 06:44:22 | [diff] [blame] | 6 | the `--run-web-tests` flag: |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 7 | |
| 8 | ```bash |
Kent Tamura | cd3ebc4 | 2018-05-16 06:44:22 | [diff] [blame] | 9 | out/Default/content_shell --run-web-tests foo.html |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 10 | ``` |
| 11 | |
| 12 | ### Compiling |
| 13 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame^] | 14 | If you want to run web tests, |
| 15 | [build the target `blink_tests`](web_tests.md); this includes all the other |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 16 | binaries required to run the tests. |
| 17 | |
| 18 | ### Running |
| 19 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame^] | 20 | You can run web tests using `run_web_tests.py` (in |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 21 | `src/third_party/blink/tools`). |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 22 | |
| 23 | ```bash |
Kent Tamura | a045a7f | 2018-04-25 05:08:11 | [diff] [blame] | 24 | third_party/blink/tools/run_web_tests.py storage/indexeddb |
pwnall | d8a25072 | 2016-11-09 18:24:03 | [diff] [blame] | 25 | ``` |
| 26 | |
| 27 | or execute the shell directly: |
| 28 | |
| 29 | ```bash |
| 30 | out/Default/content_shell --remote-debugging-port=9222 |
| 31 | ``` |
| 32 | |
| 33 | This allows you see how your changes look in Chromium, and even connect with |
| 34 | devtools (by going to http://127.0.0.1:9222 from another window) to inspect your |
| 35 | freshly compiled Blink. |
| 36 | |
| 37 | *** note |
| 38 | On the Mac, use `Content Shell.app`, not `content_shell`. |
| 39 | |
| 40 | ```bash |
| 41 | out/Default/Content\ Shell.app/Contents/MacOS/Content\ Shell --remote-debugging-port=9222 |
| 42 | ``` |
| 43 | *** |
| 44 | |
| 45 | ### Debugging Renderer Crashes |
| 46 | |
| 47 | To debug a renderer crash, ask Content Shell to wait for you to attach a |
| 48 | debugger once it spawns a renderer process by adding the |
| 49 | `--renderer-startup-dialog` flag: |
| 50 | |
| 51 | ```bash |
| 52 | out/Default/content_shell --renderer-startup-dialog |
| 53 | ``` |
| 54 | |
| 55 | Debugging workers and other subprocesses is simpler with |
| 56 | `--wait-for-debugger-children`, which can have one of two values: `plugin` or |
| 57 | `renderer`. |
| 58 | |
| 59 | ## Future Work |
| 60 | |
| 61 | ### Reusing existing testing objects |
| 62 | |
| 63 | To avoid writing (and maintaining!) yet another test controller, it is desirable |
| 64 | to reuse an existing test controller. A possible solution would be to change |
| 65 | DRT's test controller to not depend on DRT's implementation of the Blink |
| 66 | objects, but rather on the Blink interfaces. In addition, we would need to |
| 67 | extract an interface from the test shell object that can be implemented by |
| 68 | content shell. This would allow for directly using DRT's test controller in |
| 69 | content shell. |