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

Side by Side Diff: content/test/gpu/gpu_tests/cloud_storage_test_base.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 | « no previous file | content/test/gpu/gpu_tests/gpu_rasterization.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 os 8 import os
9 import re 9 import re
10 import tempfile 10 import tempfile
11 11
12 from telemetry import test 12 from telemetry import test
13 from telemetry.core import bitmap 13 from telemetry.core import bitmap
14 from telemetry.page import cloud_storage 14 from telemetry.page import cloud_storage
15 from telemetry.page import page_test 15 from telemetry.page import page_test
16 16
17 test_data_dir = os.path.abspath(os.path.join( 17 test_data_dir = os.path.abspath(os.path.join(
18 os.path.dirname(__file__), '..', '..', 'data', 'gpu')) 18 os.path.dirname(__file__), '..', '..', 'data', 'gpu'))
19 19
20 default_generated_data_dir = os.path.join(test_data_dir, 'generated') 20 default_generated_data_dir = os.path.join(test_data_dir, 'generated')
21 21
22 error_image_cloud_storage_bucket = 'chromium-browser-gpu-tests' 22 error_image_cloud_storage_bucket = 'chromium-browser-gpu-tests'
23 23
24 def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio): 24 def _CompareScreenshotSamples(screenshot, expectations, device_pixel_ratio):
25 for expectation in expectations: 25 for expectation in expectations:
26 location = expectation["location"] 26 location = expectation["location"]
27 x = location[0] * device_pixel_ratio 27 x = int(location[0] * device_pixel_ratio)
28 y = location[1] * device_pixel_ratio 28 y = int(location[1] * device_pixel_ratio)
29 29
30 if x < 0 or y < 0 or x > screenshot.width or y > screenshot.height: 30 if x < 0 or y < 0 or x > screenshot.width or y > screenshot.height:
31 raise page_test.Failure( 31 raise page_test.Failure(
32 'Expected pixel location [%d, %d] is out of range on [%d, %d] image' % 32 'Expected pixel location [%d, %d] is out of range on [%d, %d] image' %
33 (x, y, screenshot.width, screenshot.height)) 33 (x, y, screenshot.width, screenshot.height))
34 34
35 actual_color = screenshot.GetPixelColor(x, y) 35 actual_color = screenshot.GetPixelColor(x, y)
36 expected_color = bitmap.RgbaColor( 36 expected_color = bitmap.RgbaColor(
37 expectation["color"][0], 37 expectation["color"][0],
38 expectation["color"][1], 38 expectation["color"][1],
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 default='') 243 default='')
244 group.add_option('--test-machine-name', 244 group.add_option('--test-machine-name',
245 help='Name of the test machine. Specifying this argument causes this ' 245 help='Name of the test machine. Specifying this argument causes this '
246 'script to upload failure images and diffs to cloud storage directly, ' 246 'script to upload failure images and diffs to cloud storage directly, '
247 'instead of relying on the archive_gpu_pixel_test_results.py script.', 247 'instead of relying on the archive_gpu_pixel_test_results.py script.',
248 default='') 248 default='')
249 group.add_option('--generated-dir', 249 group.add_option('--generated-dir',
250 help='Overrides the default on-disk location for generated test images ' 250 help='Overrides the default on-disk location for generated test images '
251 '(only used for local testing without a cloud storage account)', 251 '(only used for local testing without a cloud storage account)',
252 default=default_generated_data_dir) 252 default=default_generated_data_dir)
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/gpu_rasterization.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698