OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from gpu_tests import cloud_storage_test_base | 5 from gpu_tests import cloud_storage_test_base |
6 from gpu_tests import gpu_rasterization_expectations | 6 from gpu_tests import gpu_rasterization_expectations |
7 import page_sets | 7 import page_sets |
8 | 8 |
9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
10 from telemetry.util import image_util | 10 from telemetry.util import image_util |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if screenshot is None: | 54 if screenshot is None: |
55 raise page_test.Failure('Could not capture screenshot') | 55 raise page_test.Failure('Could not capture screenshot') |
56 | 56 |
57 device_pixel_ratio = tab.EvaluateJavaScript('window.devicePixelRatio') | 57 device_pixel_ratio = tab.EvaluateJavaScript('window.devicePixelRatio') |
58 if hasattr(page, 'test_rect'): | 58 if hasattr(page, 'test_rect'): |
59 test_rect = [int(x * device_pixel_ratio) for x in page.test_rect] | 59 test_rect = [int(x * device_pixel_ratio) for x in page.test_rect] |
60 screenshot = image_util.Crop(screenshot, test_rect[0], test_rect[1], | 60 screenshot = image_util.Crop(screenshot, test_rect[0], test_rect[1], |
61 test_rect[2], test_rect[3]) | 61 test_rect[2], test_rect[3]) |
62 | 62 |
63 self._ValidateScreenshotSamples( | 63 self._ValidateScreenshotSamples( |
| 64 tab, |
64 page.display_name, | 65 page.display_name, |
65 screenshot, | 66 screenshot, |
66 page.expectations, | 67 page.expectations, |
67 device_pixel_ratio) | 68 device_pixel_ratio) |
68 | 69 |
69 | 70 |
70 class GpuRasterization(cloud_storage_test_base.TestBase): | 71 class GpuRasterization(cloud_storage_test_base.TestBase): |
71 """Tests that GPU rasterization produces valid content""" | 72 """Tests that GPU rasterization produces valid content""" |
72 test = GpuRasterizationValidator | 73 test = GpuRasterizationValidator |
73 | 74 |
74 def __init__(self, max_failures=None): | 75 def __init__(self, max_failures=None): |
75 super(GpuRasterization, self).__init__(max_failures=max_failures) | 76 super(GpuRasterization, self).__init__(max_failures=max_failures) |
76 | 77 |
77 @classmethod | 78 @classmethod |
78 def Name(cls): | 79 def Name(cls): |
79 return 'gpu_rasterization' | 80 return 'gpu_rasterization' |
80 | 81 |
81 def CreateStorySet(self, options): | 82 def CreateStorySet(self, options): |
82 story_set = page_sets.GpuRasterizationTestsStorySet(self.GetExpectations()) | 83 story_set = page_sets.GpuRasterizationTestsStorySet(self.GetExpectations()) |
83 for page in story_set: | 84 for page in story_set: |
84 page.script_to_evaluate_on_commit = test_harness_script | 85 page.script_to_evaluate_on_commit = test_harness_script |
85 return story_set | 86 return story_set |
86 | 87 |
87 def _CreateExpectations(self): | 88 def _CreateExpectations(self): |
88 return gpu_rasterization_expectations.GpuRasterizationExpectations() | 89 return gpu_rasterization_expectations.GpuRasterizationExpectations() |
OLD | NEW |