OLD | NEW |
1 # How to Extend the Layout Test Framework | 1 # How to Extend the Layout Test Framework |
2 | 2 |
3 The Layout Test Framework that Blink uses is a regression testing tool that is | 3 The Layout Test Framework that Blink uses is a regression testing tool that is |
4 multi-platform and it has a large amount of tools that help test varying types | 4 multi-platform and it has a large amount of tools that help test varying types |
5 of regression, such as pixel diffs, text diffs, etc. The framework is mainly | 5 of regression, such as pixel diffs, text diffs, etc. The framework is mainly |
6 used by Blink, however it was made to be extensible so that other projects can | 6 used by Blink, however it was made to be extensible so that other projects can |
7 use it test different parts of chrome (such as Print Preview). This is a guide | 7 use it test different parts of chrome (such as Print Preview). This is a guide |
8 to help people who want to actually the framework to test whatever they want. | 8 to help people who want to actually the framework to test whatever they want. |
9 | 9 |
10 [TOC] | 10 [TOC] |
11 | 11 |
12 ## Background | 12 ## Background |
13 | 13 |
14 Before you can start actually extending the framework, you should be familiar | 14 Before you can start actually extending the framework, you should be familiar |
15 with how to use it. This wiki is basically all you need to learn how to use it | 15 with how to use it. See the |
16 http://www.chromium.org/developers/testing/webkit-layout-tests | 16 [layout tests documentation](testing/layout_tests.md). |
17 | 17 |
18 ## How to Extend the Framework | 18 ## How to Extend the Framework |
19 | 19 |
20 There are two parts to actually extending framework to test a piece of software. | 20 There are two parts to actually extending framework to test a piece of software. |
21 The first part is extending certain files in: | 21 The first part is extending certain files in: |
22 [/third_party/Webkit/Tools/Scripts/webkitpy/layout_tests/](/third_party/Webkit/T
ools/Scripts/webkitpy/layout_tests/) | 22 [/third_party/Webkit/Tools/Scripts/webkitpy/layout_tests/](/third_party/Webkit/T
ools/Scripts/webkitpy/layout_tests/) |
23 The code in `webkitpy/layout_tests` is the layout test framework itself | 23 The code in `webkitpy/layout_tests` is the layout test framework itself |
24 | 24 |
25 The second part is creating a driver (program) to actually communicate the | 25 The second part is creating a driver (program) to actually communicate the |
26 layout test framework. This part is significantly more tricky and dependant on | 26 layout test framework. This part is significantly more tricky and dependant on |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 * It should be overridden to return the driver extension class created | 122 * It should be overridden to return the driver extension class created |
123 earlier. This function doesn’t return an instance on the driver, just | 123 earlier. This function doesn’t return an instance on the driver, just |
124 the class itself. | 124 the class itself. |
125 * `driver_name` | 125 * `driver_name` |
126 * This should return the name of the program test p. By default it returns | 126 * This should return the name of the program test p. By default it returns |
127 ‘content_shell’, but you want to have it return the program you want to | 127 ‘content_shell’, but you want to have it return the program you want to |
128 run, such as `chrome` or `browser_tests`. | 128 run, such as `chrome` or `browser_tests`. |
129 * `layout_tests_dir` | 129 * `layout_tests_dir` |
130 * This tells the port where to look for all the and everything associated | 130 * This tells the port where to look for all the and everything associated |
131 with them such as resources files. | 131 with them such as resources files. |
132 * By default it returns absolute path to the webkit tests. | 132 * By default it returns the absolute path to the layout tests directory. |
133 * If you are planning on running something in the chromium src/ directory, | 133 * If you are planning on running something in the chromium src/ directory, |
134 there are helper functions to allow you to return a path relative to the | 134 there are helper functions to allow you to return a path relative to the |
135 base of the chromium src directory. | 135 base of the chromium src directory. |
136 | 136 |
137 The rest of the functions can definitely be overridden for your projects | 137 The rest of the functions can definitely be overridden for your projects |
138 specific needs, however these are the bare minimum needed to get it running. | 138 specific needs, however these are the bare minimum needed to get it running. |
139 There are also functions you can override to make certain actions that aren’t on | 139 There are also functions you can override to make certain actions that aren’t on |
140 by default always take place. For example, the layout test framework always | 140 by default always take place. For example, the layout test framework always |
141 checks for system dependencies unless you pass in a switch. If you want them | 141 checks for system dependencies unless you pass in a switch. If you want them |
142 disabled for your project, just override `check_sys_deps` to always return OK. | 142 disabled for your project, just override `check_sys_deps` to always return OK. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 * In this case this is how your output should look. | 252 * In this case this is how your output should look. |
253 * “Content-type: image/png\n” | 253 * “Content-type: image/png\n” |
254 * “ActualHash: hashData\n” | 254 * “ActualHash: hashData\n” |
255 * “Content-Length: lengthOfPng\n” | 255 * “Content-Length: lengthOfPng\n” |
256 * “pngdata” | 256 * “pngdata” |
257 * This part doesn’t need a header specifying that you are | 257 * This part doesn’t need a header specifying that you are |
258 sending png data, just send it | 258 sending png data, just send it |
259 * “#EOF\n” on both stdout and stderr | 259 * “#EOF\n” on both stdout and stderr |
260 * To see the structure of the data required, look at the | 260 * To see the structure of the data required, look at the |
261 `read_block` functions in Driver.py | 261 `read_block` functions in Driver.py |
OLD | NEW |