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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 # Even though the Maps test uses a fixed devicePixelRatio so that | 47 # 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 | 48 # it fetches all of the map tiles at the same resolution, on two |
49 # different devices with the same devicePixelRatio (a Retina | 49 # different devices with the same devicePixelRatio (a Retina |
50 # MacBook Pro and a Nexus 9), different scale factors of the final | 50 # MacBook Pro and a Nexus 9), different scale factors of the final |
51 # screenshot are observed. Hack around this by specifying a scale | 51 # screenshot are observed. Hack around this by specifying a scale |
52 # factor for these bots in the test expectations. This relies on | 52 # factor for these bots in the test expectations. This relies on |
53 # the test-machine-name argument being specified on the command | 53 # the test-machine-name argument being specified on the command |
54 # line. | 54 # line. |
55 expected = self._ReadPixelExpectations(page) | 55 expected = self._ReadPixelExpectations(page) |
56 self._ValidateScreenshotSamples( | 56 self._ValidateScreenshotSamples( |
57 page.display_name, screenshot, expected, dpr) | 57 tab, page.display_name, screenshot, expected, dpr) |
58 | 58 |
59 @staticmethod | 59 @staticmethod |
60 def SpinWaitOnRAF(tab, iterations, timeout=60): | 60 def SpinWaitOnRAF(tab, iterations, timeout=60): |
61 waitScript = r""" | 61 waitScript = r""" |
62 window.__spinWaitOnRAFDone = false; | 62 window.__spinWaitOnRAFDone = false; |
63 var iterationsLeft = %d; | 63 var iterationsLeft = %d; |
64 | 64 |
65 function spin() { | 65 function spin() { |
66 iterationsLeft--; | 66 iterationsLeft--; |
67 if (iterationsLeft == 0) { | 67 if (iterationsLeft == 0) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 def CreateStorySet(self, options): | 130 def CreateStorySet(self, options): |
131 story_set_path = os.path.join( | 131 story_set_path = os.path.join( |
132 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') | 132 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') |
133 ps = story_set_module.StorySet( | 133 ps = story_set_module.StorySet( |
134 archive_data_file='data/maps.json', | 134 archive_data_file='data/maps.json', |
135 base_dir=story_set_path, | 135 base_dir=story_set_path, |
136 cloud_storage_bucket=story_module.PUBLIC_BUCKET) | 136 cloud_storage_bucket=story_module.PUBLIC_BUCKET) |
137 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) | 137 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) |
138 return ps | 138 return ps |
OLD | NEW |