Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: docs/how_to_extend_layout_test_framework.md

Issue 1318153003: [Docs] fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | docs/linux_build_instructions.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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]
(...skipping 13 matching lines...) Expand all
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
27 what exactly exactly is being tested. 27 what exactly exactly is being tested.
28 28
29 ### Part 1 29 ### Part 1
30 30
31 This part isn’t too difficult. There are basically two classes that need to be 31 This part isn’t too difficult. There are basically two classes that need to be
32 extended (ideally, just inherited from). These classes are: 32 extended (ideally, just inherited from). These classes are:
33 33
34 Driver 34 * `Driver`. Located in `layout_tests/port/driver.py`. Each instance of this is
35 35 the class that will actually an instance of the program that produces the
36 Located in `layout_tests/port/driver.py`. Each instance of this is the class 36 test data (program in Part 2).
37 that will actually an instance of the program that produces the test data 37 * `Port`. Located in `layout_tests/port/base.py`. This class is responsible
38 (program in Part 2). 38 creating drivers with the correct settings, giving access to certain OS
39 39 functionality to access expected files, etc.
40 Port
41
42 Located in `layout_tests/port/base.py`. This class is responsible creating
43 drivers with the correct settings, giving access to certain OS functionality to
44 access expected files, etc.
45 40
46 #### Extending Driver 41 #### Extending Driver
47 42
48 As said, Driver launches the program from Part 2. Said program will communicate 43 As said, Driver launches the program from Part 2. Said program will communicate
49 with the driver class to receive instructions and send back data. All of the 44 with the driver class to receive instructions and send back data. All of the
50 work for driver gets done in `Driver.run_test`. Everything else is a helper or 45 work for driver gets done in `Driver.run_test`. Everything else is a helper or
51 initialization function. 46 initialization function.
52 47
53 `run_test()` steps: 48 `run_test()` steps:
54 49
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 problems, therefore port itself shouldn’t be extend. Instead LinuxPort, WinPort, 107 problems, therefore port itself shouldn’t be extend. Instead LinuxPort, WinPort,
113 and MacPort (and maybe the android port class) should be extended as they 108 and MacPort (and maybe the android port class) should be extended as they
114 provide platform specific overrides/extensions that implement most of the 109 provide platform specific overrides/extensions that implement most of the
115 important functionality. While there are many functions in Port, overriding one 110 important functionality. While there are many functions in Port, overriding one
116 function will affect most of the other ones to get the desired behavior. For 111 function will affect most of the other ones to get the desired behavior. For
117 example, if `layout_tests_dir()` is overriden, not only will the code look for 112 example, if `layout_tests_dir()` is overriden, not only will the code look for
118 tests in that directory, but it will find the correct TestExpectations file, the 113 tests in that directory, but it will find the correct TestExpectations file, the
119 platform specific expected files, etc. 114 platform specific expected files, etc.
120 115
121 Here are some of the functions that most likely need to be overridden. 116 Here are some of the functions that most likely need to be overridden.
117
122 * `driver_class` 118 * `driver_class`
123 * This should be overridden to allow the testing program to actually run. 119 * This should be overridden to allow the testing program to actually run.
124 By default the code will run content_shell, which might or might not be 120 By default the code will run content_shell, which might or might not be
125 what you want. 121 what you want.
126 * It should be overridden to return the driver extension class created 122 * It should be overridden to return the driver extension class created
127 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
128 the class itself. 124 the class itself.
129 * `driver_name` 125 * `driver_name`
130 * 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
131 ‘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
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 * In this case this is how your output should look. 252 * In this case this is how your output should look.
257 * “Content-type: image/png\n” 253 * “Content-type: image/png\n”
258 * “ActualHash: hashData\n” 254 * “ActualHash: hashData\n”
259 * “Content-Length: lengthOfPng\n” 255 * “Content-Length: lengthOfPng\n”
260 * “pngdata” 256 * “pngdata”
261 * This part doesn’t need a header specifying that you are 257 * This part doesn’t need a header specifying that you are
262 sending png data, just send it 258 sending png data, just send it
263 * “#EOF\n” on both stdout and stderr 259 * “#EOF\n” on both stdout and stderr
264 * To see the structure of the data required, look at the 260 * To see the structure of the data required, look at the
265 `read_block` functions in Driver.py 261 `read_block` functions in Driver.py
OLDNEW
« no previous file with comments | « no previous file | docs/linux_build_instructions.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698