OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import glob | 4 import glob |
5 import json | 5 import json |
6 import os | 6 import os |
7 import re | 7 import re |
8 | 8 |
9 from gpu_tests import cloud_storage_test_base | 9 from gpu_tests import cloud_storage_test_base |
10 from gpu_tests import pixel_expectations | 10 from gpu_tests import pixel_expectations |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 screenshot = image_util.Crop( | 72 screenshot = image_util.Crop( |
73 screenshot, page.test_rect[0] * dpr, page.test_rect[1] * dpr, | 73 screenshot, page.test_rect[0] * dpr, page.test_rect[1] * dpr, |
74 page.test_rect[2] * dpr, page.test_rect[3] * dpr) | 74 page.test_rect[2] * dpr, page.test_rect[3] * dpr) |
75 | 75 |
76 if hasattr(page, 'expected_colors'): | 76 if hasattr(page, 'expected_colors'): |
77 # Use expected pixels instead of ref images for validation. | 77 # Use expected pixels instead of ref images for validation. |
78 expected_colors_file = os.path.abspath(os.path.join( | 78 expected_colors_file = os.path.abspath(os.path.join( |
79 os.path.dirname(__file__), page.expected_colors)) | 79 os.path.dirname(__file__), page.expected_colors)) |
80 expected_colors = self._ReadPixelExpectations(expected_colors_file) | 80 expected_colors = self._ReadPixelExpectations(expected_colors_file) |
81 self._ValidateScreenshotSamples( | 81 self._ValidateScreenshotSamples( |
82 page.display_name, screenshot, expected_colors, dpr) | 82 tab, page.display_name, screenshot, expected_colors, dpr) |
83 return | 83 return |
84 | 84 |
85 image_name = self._UrlToImageName(page.display_name) | 85 image_name = self._UrlToImageName(page.display_name) |
86 | 86 |
87 if self.options.upload_refimg_to_cloud_storage: | 87 if self.options.upload_refimg_to_cloud_storage: |
88 if self._ConditionallyUploadToCloudStorage(image_name, page, tab, | 88 if self._ConditionallyUploadToCloudStorage(image_name, page, tab, |
89 screenshot): | 89 screenshot): |
90 # This is the new reference image; there's nothing to compare against. | 90 # This is the new reference image; there's nothing to compare against. |
91 ref_png = screenshot | 91 ref_png = screenshot |
92 else: | 92 else: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 def CreateStorySet(self, options): | 183 def CreateStorySet(self, options): |
184 story_set = page_sets.PixelTestsStorySet(self.GetExpectations(), | 184 story_set = page_sets.PixelTestsStorySet(self.GetExpectations(), |
185 try_es3=True) | 185 try_es3=True) |
186 for page in story_set: | 186 for page in story_set: |
187 page.script_to_evaluate_on_commit = test_harness_script | 187 page.script_to_evaluate_on_commit = test_harness_script |
188 return story_set | 188 return story_set |
189 | 189 |
190 def _CreateExpectations(self): | 190 def _CreateExpectations(self): |
191 return pixel_expectations.PixelExpectations() | 191 return pixel_expectations.PixelExpectations() |
OLD | NEW |