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

Side by Side Diff: content/test/gpu/gpu_tests/gpu_rasterization.py

Issue 303113004: gpu testing: Handle non-integral device pixel ratio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/test/gpu/gpu_tests/cloud_storage_test_base.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import optparse 5 import optparse
6 import cloud_storage_test_base 6 import cloud_storage_test_base
7 7
8 test_harness_script = r""" 8 test_harness_script = r"""
9 var domAutomationController = {}; 9 var domAutomationController = {};
10 domAutomationController._succeeded = false; 10 domAutomationController._succeeded = false;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 if not tab.screenshot_supported: 43 if not tab.screenshot_supported:
44 raise page_test.Failure('Browser does not support screenshot capture') 44 raise page_test.Failure('Browser does not support screenshot capture')
45 45
46 screenshot = tab.Screenshot() 46 screenshot = tab.Screenshot()
47 if not screenshot: 47 if not screenshot:
48 raise page_test.Failure('Could not capture screenshot') 48 raise page_test.Failure('Could not capture screenshot')
49 49
50 device_pixel_ratio = tab.EvaluateJavaScript('window.devicePixelRatio') 50 device_pixel_ratio = tab.EvaluateJavaScript('window.devicePixelRatio')
51 if hasattr(page, 'test_rect'): 51 if hasattr(page, 'test_rect'):
52 test_rect = [x * device_pixel_ratio for x in page.test_rect] 52 test_rect = [int(x * device_pixel_ratio) for x in page.test_rect]
53 screenshot = screenshot.Crop( 53 screenshot = screenshot.Crop(
54 test_rect[0], test_rect[1], 54 test_rect[0], test_rect[1],
55 test_rect[2], test_rect[3]) 55 test_rect[2], test_rect[3])
56 56
57 self._ValidateScreenshotSamples( 57 self._ValidateScreenshotSamples(
58 page.display_name, 58 page.display_name,
59 screenshot, 59 screenshot,
60 page.expectations, 60 page.expectations,
61 device_pixel_ratio) 61 device_pixel_ratio)
62 62
63 63
64 class GpuRasterization(cloud_storage_test_base.TestBase): 64 class GpuRasterization(cloud_storage_test_base.TestBase):
65 """Tests that GPU rasterization produces valid content""" 65 """Tests that GPU rasterization produces valid content"""
66 test = _GpuRasterizationValidator 66 test = _GpuRasterizationValidator
67 page_set = 'page_sets/gpu_rasterization_tests.py' 67 page_set = 'page_sets/gpu_rasterization_tests.py'
68 68
69 def CreatePageSet(self, options): 69 def CreatePageSet(self, options):
70 page_set = super(GpuRasterization, self).CreatePageSet(options) 70 page_set = super(GpuRasterization, self).CreatePageSet(options)
71 for page in page_set.pages: 71 for page in page_set.pages:
72 page.script_to_evaluate_on_commit = test_harness_script 72 page.script_to_evaluate_on_commit = test_harness_script
73 return page_set 73 return page_set
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/cloud_storage_test_base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698