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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 def _ReadPixelExpectations(self, page): | 82 def _ReadPixelExpectations(self, page): |
83 expectations_path = os.path.join(page._base_dir, page.pixel_expectations) | 83 expectations_path = os.path.join(page._base_dir, page.pixel_expectations) |
84 with open(expectations_path, 'r') as f: | 84 with open(expectations_path, 'r') as f: |
85 json_contents = json.load(f) | 85 json_contents = json.load(f) |
86 return json_contents | 86 return json_contents |
87 | 87 |
88 | 88 |
89 class MapsPage(gpu_test_base.PageBase): | 89 class MapsPage(gpu_test_base.PageBase): |
90 def __init__(self, story_set, base_dir, expectations): | 90 def __init__(self, story_set, base_dir, expectations): |
91 super(MapsPage, self).__init__( | 91 super(MapsPage, self).__init__( |
92 url='http://localhost:8000/performance.html', | 92 url='http://map-test/performance.html', |
93 page_set=story_set, | 93 page_set=story_set, |
94 base_dir=base_dir, | 94 base_dir=base_dir, |
95 name='Maps.maps_004', | 95 name='Maps.maps_004', |
96 make_javascript_deterministic=False, | 96 make_javascript_deterministic=False, |
97 expectations=expectations) | 97 expectations=expectations) |
98 self.pixel_expectations = 'data/maps_004_expectations.json' | 98 self.pixel_expectations = 'data/maps_004_expectations.json' |
99 | 99 |
100 def RunNavigateSteps(self, action_runner): | 100 def RunNavigateSteps(self, action_runner): |
101 super(MapsPage, self).RunNavigateSteps(action_runner) | 101 super(MapsPage, self).RunNavigateSteps(action_runner) |
102 action_runner.WaitForJavaScriptCondition( | 102 action_runner.WaitForJavaScriptCondition( |
103 'window.testDone', timeout_in_seconds=180) | 103 'window.testDone', timeout_in_seconds=180) |
104 | 104 |
105 | 105 |
106 class Maps(cloud_storage_test_base.CloudStorageTestBase): | 106 class Maps(cloud_storage_test_base.CloudStorageTestBase): |
107 """Google Maps pixel tests. | 107 """Google Maps pixel tests. |
108 | 108 |
109 Note: the WPR for this test was recorded from the smoothness.maps | 109 Note: the WPR for this test was recorded from the smoothness.maps |
110 benchmark's similar page. The Maps team gave us a build of their | 110 benchmark's similar page. The Maps team gave us a build of their |
111 test. The only modification to the test was to config.js, where the | 111 test. The only modification to the test was to config.js, where the |
112 width and height query args were set to 800 by 600. The WPR was | 112 width and height query args were set to 800 by 600. The WPR was |
113 recorded with: | 113 recorded with: |
114 | 114 |
115 tools/perf/record_wpr smoothness_maps --browser=system --upload | 115 tools/perf/record_wpr smoothness_maps --browser=system --upload |
116 | 116 |
117 Then the maps_???.wpr.sha1 and maps.json were copied from | 117 Then the maps_???.wpr.sha1 and maps.json were copied from |
118 tools/perf/page_sets/data into content/test/gpu/page_sets/data. The | 118 tools/perf/page_sets/data into content/test/gpu/page_sets/data. The |
119 same sha1 file and json file need to be copied into both of these | 119 same sha1 file and json file need to be copied into both of these |
120 directories in any CL which updates the recording.""" | 120 directories in any CL which updates the recording.""" |
Ken Russell (switch to Gerrit)
2016/09/15 17:52:18
Could you please add the postprocessing step above
nednguyen
2016/09/15 23:24:35
Done.
| |
121 test = MapsValidator | 121 test = MapsValidator |
122 | 122 |
123 @classmethod | 123 @classmethod |
124 def Name(cls): | 124 def Name(cls): |
125 return 'maps' | 125 return 'maps' |
126 | 126 |
127 def _CreateExpectations(self): | 127 def _CreateExpectations(self): |
128 return maps_expectations.MapsExpectations() | 128 return maps_expectations.MapsExpectations() |
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 |