OLD | NEW |
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 """Runs a Google Maps pixel test. | 5 """Runs a Google Maps pixel test. |
6 Performs several common navigation actions on the map (pan, zoom, rotate) then | 6 Performs several common navigation actions on the map (pan, zoom, rotate) then |
7 captures a screenshot and compares selected pixels against expected values""" | 7 captures a screenshot and compares selected pixels against expected values""" |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
11 | 11 |
12 from gpu_tests import cloud_storage_test_base | 12 from gpu_tests import cloud_storage_test_base |
13 from gpu_tests import gpu_test_base | 13 from gpu_tests import gpu_test_base |
14 from gpu_tests import maps_expectations | 14 from gpu_tests import maps_expectations |
15 from gpu_tests import path_util | 15 from gpu_tests import path_util |
16 | 16 |
17 from telemetry.core import util | 17 from telemetry.core import util |
18 from telemetry.page import page_test | 18 from telemetry.page import legacy_page_test |
19 from telemetry import story as story_module | 19 from telemetry import story as story_module |
20 from telemetry.story import story_set as story_set_module | 20 from telemetry.story import story_set as story_set_module |
21 | 21 |
22 | 22 |
23 class MapsValidator(cloud_storage_test_base.ValidatorBase): | 23 class MapsValidator(cloud_storage_test_base.ValidatorBase): |
24 def __init__(self): | 24 def __init__(self): |
25 super(MapsValidator, self).__init__() | 25 super(MapsValidator, self).__init__() |
26 | 26 |
27 def CustomizeBrowserOptions(self, options): | 27 def CustomizeBrowserOptions(self, options): |
28 # --test-type=gpu is used only to suppress the "Google API Keys are missing" | 28 # --test-type=gpu is used only to suppress the "Google API Keys are missing" |
29 # infobar, which causes flakiness in tests. | 29 # infobar, which causes flakiness in tests. |
30 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', | 30 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', |
31 '--test-type=gpu']) | 31 '--test-type=gpu']) |
32 | 32 |
33 def ValidateAndMeasurePage(self, page, tab, results): | 33 def ValidateAndMeasurePage(self, page, tab, results): |
34 # TODO: This should not be necessary, but it's not clear if the test is | 34 # TODO: This should not be necessary, but it's not clear if the test is |
35 # failing on the bots in it's absence. Remove once we can verify that it's | 35 # failing on the bots in it's absence. Remove once we can verify that it's |
36 # safe to do so. | 36 # safe to do so. |
37 MapsValidator.SpinWaitOnRAF(tab, 3) | 37 MapsValidator.SpinWaitOnRAF(tab, 3) |
38 | 38 |
39 if not tab.screenshot_supported: | 39 if not tab.screenshot_supported: |
40 raise page_test.Failure('Browser does not support screenshot capture') | 40 raise legacy_page_test.Failure( |
| 41 'Browser does not support screenshot capture') |
41 screenshot = tab.Screenshot(5) | 42 screenshot = tab.Screenshot(5) |
42 if screenshot is None: | 43 if screenshot is None: |
43 raise page_test.Failure('Could not capture screenshot') | 44 raise legacy_page_test.Failure('Could not capture screenshot') |
44 | 45 |
45 dpr = tab.EvaluateJavaScript('window.devicePixelRatio') | 46 dpr = tab.EvaluateJavaScript('window.devicePixelRatio') |
46 print 'Maps\' devicePixelRatio is ' + str(dpr) | 47 print 'Maps\' devicePixelRatio is ' + str(dpr) |
47 # Even though the Maps test uses a fixed devicePixelRatio so that | 48 # Even though the Maps test uses a fixed devicePixelRatio so that |
48 # it fetches all of the map tiles at the same resolution, on two | 49 # it fetches all of the map tiles at the same resolution, on two |
49 # different devices with the same devicePixelRatio (a Retina | 50 # different devices with the same devicePixelRatio (a Retina |
50 # MacBook Pro and a Nexus 9), different scale factors of the final | 51 # MacBook Pro and a Nexus 9), different scale factors of the final |
51 # screenshot are observed. Hack around this by specifying a scale | 52 # screenshot are observed. Hack around this by specifying a scale |
52 # factor for these bots in the test expectations. This relies on | 53 # factor for these bots in the test expectations. This relies on |
53 # the test-machine-name argument being specified on the command | 54 # the test-machine-name argument being specified on the command |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 142 |
142 def CreateStorySet(self, options): | 143 def CreateStorySet(self, options): |
143 story_set_path = os.path.join( | 144 story_set_path = os.path.join( |
144 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') | 145 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') |
145 ps = story_set_module.StorySet( | 146 ps = story_set_module.StorySet( |
146 archive_data_file='data/maps.json', | 147 archive_data_file='data/maps.json', |
147 base_dir=story_set_path, | 148 base_dir=story_set_path, |
148 cloud_storage_bucket=story_module.PUBLIC_BUCKET) | 149 cloud_storage_bucket=story_module.PUBLIC_BUCKET) |
149 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) | 150 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) |
150 return ps | 151 return ps |
OLD | NEW |