| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Base classes for a test and validator which upload results | 5 """Base classes for a test and validator which upload results |
| 6 (reference images, error images) to cloud storage.""" | 6 (reference images, error images) to cloud storage.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio, | 27 def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio, |
| 28 test_machine_name): | 28 test_machine_name): |
| 29 # First scan through the expectations and see if there are any scale | 29 # First scan through the expectations and see if there are any scale |
| 30 # factor overrides that would preempt the device pixel ratio. This | 30 # factor overrides that would preempt the device pixel ratio. This |
| 31 # is mainly a workaround for complex tests like the Maps test. | 31 # is mainly a workaround for complex tests like the Maps test. |
| 32 if test_machine_name: | 32 if test_machine_name: |
| 33 for expectation in expectations: | 33 for expectation in expectations: |
| 34 if "scale_factor_overrides" in expectation: | 34 if "scale_factor_overrides" in expectation: |
| 35 for override in expectation["scale_factor_overrides"]: | 35 for override in expectation["scale_factor_overrides"]: |
| 36 if override["machine_name"] in test_machine_name: | 36 # Require exact match to avoid confusion, because some |
| 37 # machine models and names might be subsets of others |
| 38 # (e.g. Nexus 5 vs Nexus 5X). |
| 39 if override["machine_name"] == test_machine_name: |
| 37 logging.warning('Overriding device_pixel_ratio ' + | 40 logging.warning('Overriding device_pixel_ratio ' + |
| 38 str(device_pixel_ratio) + ' with scale factor ' + | 41 str(device_pixel_ratio) + ' with scale factor ' + |
| 39 str(override["scale_factor"])) | 42 str(override["scale_factor"])) |
| 40 device_pixel_ratio = override["scale_factor"] | 43 device_pixel_ratio = override["scale_factor"] |
| 41 break | 44 break |
| 42 break | 45 break |
| 43 for expectation in expectations: | 46 for expectation in expectations: |
| 44 if "scale_factor_overrides" in expectation: | 47 if "scale_factor_overrides" in expectation: |
| 45 continue | 48 continue |
| 46 location = expectation["location"] | 49 location = expectation["location"] |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 default='') | 281 default='') |
| 279 group.add_option('--test-machine-name', | 282 group.add_option('--test-machine-name', |
| 280 help='Name of the test machine. Specifying this argument causes this ' | 283 help='Name of the test machine. Specifying this argument causes this ' |
| 281 'script to upload failure images and diffs to cloud storage directly, ' | 284 'script to upload failure images and diffs to cloud storage directly, ' |
| 282 'instead of relying on the archive_gpu_pixel_test_results.py script.', | 285 'instead of relying on the archive_gpu_pixel_test_results.py script.', |
| 283 default='') | 286 default='') |
| 284 group.add_option('--generated-dir', | 287 group.add_option('--generated-dir', |
| 285 help='Overrides the default on-disk location for generated test images ' | 288 help='Overrides the default on-disk location for generated test images ' |
| 286 '(only used for local testing without a cloud storage account)', | 289 '(only used for local testing without a cloud storage account)', |
| 287 default=default_generated_data_dir) | 290 default=default_generated_data_dir) |
| OLD | NEW |