| 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 |
| 116 | 116 |
| 117 Then the maps_???.wpr.sha1 and maps.json were copied from | 117 This would produce maps_???.wpr 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. |
| 119 same sha1 file and json file need to be copied into both of these | 119 It worths noting that telemetry no longer allows replaying URL that has form |
| 120 of local host. If the recording was created for locahost URL, ones can update |
| 121 the host name by running: |
| 122 web-page-replay/httparchive.py remap-host maps_004.wpr \ |
| 123 localhost:10020 map-test |
| 124 (web-page-replay/ can be found in third_party/catapult/telemetry/third_party/) |
| 125 After update the host name in WPR archive, please remember to update the host |
| 126 URL in content/test/gpu/gpu_tests/maps.py as well. |
| 127 |
| 128 To upload the maps_???.wpr to cloud storage, one would run: |
| 129 depot_tools/upload_to_google_storage.py --bucket=chromium-telemetry \ |
| 130 maps_???.wpr |
| 131 The same sha1 file and json file need to be copied into both of these |
| 120 directories in any CL which updates the recording.""" | 132 directories in any CL which updates the recording.""" |
| 121 test = MapsValidator | 133 test = MapsValidator |
| 122 | 134 |
| 123 @classmethod | 135 @classmethod |
| 124 def Name(cls): | 136 def Name(cls): |
| 125 return 'maps' | 137 return 'maps' |
| 126 | 138 |
| 127 def _CreateExpectations(self): | 139 def _CreateExpectations(self): |
| 128 return maps_expectations.MapsExpectations() | 140 return maps_expectations.MapsExpectations() |
| 129 | 141 |
| 130 def CreateStorySet(self, options): | 142 def CreateStorySet(self, options): |
| 131 story_set_path = os.path.join( | 143 story_set_path = os.path.join( |
| 132 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') | 144 path_util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') |
| 133 ps = story_set_module.StorySet( | 145 ps = story_set_module.StorySet( |
| 134 archive_data_file='data/maps.json', | 146 archive_data_file='data/maps.json', |
| 135 base_dir=story_set_path, | 147 base_dir=story_set_path, |
| 136 cloud_storage_bucket=story_module.PUBLIC_BUCKET) | 148 cloud_storage_bucket=story_module.PUBLIC_BUCKET) |
| 137 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) | 149 ps.AddStory(MapsPage(ps, ps.base_dir, self.GetExpectations())) |
| 138 return ps | 150 return ps |
| OLD | NEW |