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

Unified Diff: content/test/gpu/gpu_tests/cloud_storage_test_base.py

Issue 2010363002: Update Maps pixel test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove debugging prints from presubmit script. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/maps.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/maps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698