Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py |
| index a79ed87878cb56b9985e8570125419426ad0d83f..0ee1dd3e730b69cc478779ee96ec2b54f60bb029 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py |
| @@ -27,6 +27,7 @@ |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +from collections import namedtuple |
|
Dirk Pranke
2017/03/20 23:22:27
Nit: this line goes between lines 32 and 34.
Gleb Lanbin
2017/03/21 17:31:52
Done.
|
| import logging |
| import re |
| @@ -70,6 +71,8 @@ class SingleTestRunner(object): |
| self._worker_name = worker_name |
| self._test_name = test_input.test_name |
| self._should_run_pixel_test = test_input.should_run_pixel_test |
| + self._should_run_pixel_test_first = ( |
| + test_input.should_run_pixel_test_first) |
| self._reference_files = test_input.reference_files |
| self._should_add_missing_baselines = test_input.should_add_missing_baselines |
| self._stop_when_done = stop_when_done |
| @@ -283,11 +286,30 @@ class SingleTestRunner(object): |
| is_testharness_test, testharness_failures = self._compare_testharness_test(driver_output, expected_driver_output) |
| if is_testharness_test: |
| failures.extend(testharness_failures) |
| + |
| + function = namedtuple('Function', 'call args') |
|
Dirk Pranke
2017/03/20 23:22:27
Nit: I would do this slightly different. I'd just
Gleb Lanbin
2017/03/21 17:31:52
Done.
|
| + compare_functions = [] |
| + compare_image_fn = function(self._compare_image, ( |
| + expected_driver_output, driver_output)) |
| + compare_txt_fn = function(self._compare_text, ( |
| + expected_driver_output.text, driver_output.text)) |
| + compare_audio_fn = function(self._compare_audio, ( |
| + expected_driver_output.audio, driver_output.audio)) |
| + |
| + if self._should_run_pixel_test_first: |
| + if driver_output.image_hash: |
| + compare_functions.append(compare_image_fn) |
| + else: |
| + compare_functions.append(compare_txt_fn) |
| else: |
| - failures.extend(self._compare_text(expected_driver_output.text, driver_output.text)) |
| - failures.extend(self._compare_audio(expected_driver_output.audio, driver_output.audio)) |
| - if self._should_run_pixel_test: |
| - failures.extend(self._compare_image(expected_driver_output, driver_output)) |
| + compare_functions.append(compare_txt_fn) |
| + if self._should_run_pixel_test: |
| + compare_functions.append(compare_image_fn) |
| + compare_functions.append(compare_audio_fn) |
| + |
| + for compare_function in compare_functions: |
|
Dirk Pranke
2017/03/20 23:22:27
and change this for line to:
for func, first_ar
Gleb Lanbin
2017/03/21 17:31:52
partially done. I switched to an unnamed tuple but
|
| + failures.extend(compare_function.call(*compare_function.args)) |
| + |
| has_repaint_overlay = (repaint_overlay.result_contains_repaint_rects(expected_driver_output.text) or |
| repaint_overlay.result_contains_repaint_rects(driver_output.text)) |
| return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr(), |