| Index: content/test/gpu/gpu_tests/cloud_storage_test_base.py
|
| diff --git a/content/test/gpu/gpu_tests/cloud_storage_test_base.py b/content/test/gpu/gpu_tests/cloud_storage_test_base.py
|
| index d218d3ff9512b8edc615503ac6dc78ea23d400f2..fee9ba2b5f3cfebfffdf641e35251be6009e3d28 100644
|
| --- a/content/test/gpu/gpu_tests/cloud_storage_test_base.py
|
| +++ b/content/test/gpu/gpu_tests/cloud_storage_test_base.py
|
| @@ -5,6 +5,7 @@
|
| """Base classes for a test and validator which upload results
|
| (reference images, error images) to cloud storage."""
|
|
|
| +import logging
|
| import os
|
| import re
|
| import tempfile
|
| @@ -23,8 +24,25 @@ default_generated_data_dir = os.path.join(test_data_dir, 'generated')
|
|
|
| error_image_cloud_storage_bucket = 'chromium-browser-gpu-tests'
|
|
|
| -def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio):
|
| +def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio,
|
| + test_machine_name):
|
| + # First scan through the expectations and see if there are any scale
|
| + # factor overrides that would preempt the device pixel ratio. This
|
| + # is mainly a workaround for complex tests like the Maps test.
|
| + if test_machine_name:
|
| + for expectation in expectations:
|
| + if "scale_factor_overrides" in expectation:
|
| + for override in expectation["scale_factor_overrides"]:
|
| + if override["machine_name"] in test_machine_name:
|
| + logging.warning('Overriding device_pixel_ratio ' +
|
| + str(device_pixel_ratio) + ' with scale factor ' +
|
| + str(override["scale_factor"]))
|
| + device_pixel_ratio = override["scale_factor"]
|
| + break
|
| + break
|
| for expectation in expectations:
|
| + if "scale_factor_overrides" in expectation:
|
| + continue
|
| location = expectation["location"]
|
| size = expectation["size"]
|
| x0 = int(location[0] * device_pixel_ratio)
|
| @@ -48,6 +66,7 @@ def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio):
|
| expectation["color"][2])
|
| if not actual_color.IsEqual(expected_color, expectation["tolerance"]):
|
| raise page_test.Failure('Expected pixel at ' + str(location) +
|
| + ' (actual pixel (' + str(x) + ', ' + str(y) + ')) ' +
|
| ' to be ' +
|
| str(expectation["color"]) + " but got [" +
|
| str(actual_color.r) + ", " +
|
| @@ -219,7 +238,8 @@ class ValidatorBase(gpu_test_base.ValidatorBase):
|
| a Failure and dumps the screenshot locally or cloud storage depending on
|
| what machine the test is being run."""
|
| try:
|
| - _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio)
|
| + _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio,
|
| + self.options.test_machine_name)
|
| except page_test.Failure:
|
| image_name = self._UrlToImageName(url)
|
| if self.options.test_machine_name:
|
|
|