| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 image_path) | 158 image_path) |
| 159 | 159 |
| 160 self._WriteImage(image_path, screenshot) | 160 self._WriteImage(image_path, screenshot) |
| 161 return screenshot | 161 return screenshot |
| 162 | 162 |
| 163 def _ReadPixelExpectations(self, json_file_path): | 163 def _ReadPixelExpectations(self, json_file_path): |
| 164 with open(json_file_path, 'r') as f: | 164 with open(json_file_path, 'r') as f: |
| 165 json_contents = json.load(f) | 165 json_contents = json.load(f) |
| 166 return json_contents | 166 return json_contents |
| 167 | 167 |
| 168 class Pixel(cloud_storage_test_base.TestBase): | 168 class Pixel(cloud_storage_test_base.CloudStorageTestBase): |
| 169 test = PixelValidator | 169 test = PixelValidator |
| 170 | 170 |
| 171 @classmethod | 171 @classmethod |
| 172 def Name(cls): | 172 def Name(cls): |
| 173 return 'pixel' | 173 return 'pixel' |
| 174 | 174 |
| 175 @classmethod | 175 @classmethod |
| 176 def AddBenchmarkCommandLineArgs(cls, group): | 176 def AddBenchmarkCommandLineArgs(cls, group): |
| 177 super(Pixel, cls).AddBenchmarkCommandLineArgs(group) | 177 super(Pixel, cls).AddBenchmarkCommandLineArgs(group) |
| 178 group.add_option('--reference-dir', | 178 group.add_option('--reference-dir', |
| 179 help='Overrides the default on-disk location for reference images ' | 179 help='Overrides the default on-disk location for reference images ' |
| 180 '(only used for local testing without a cloud storage account)', | 180 '(only used for local testing without a cloud storage account)', |
| 181 default=default_reference_image_dir) | 181 default=default_reference_image_dir) |
| 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 |