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 optparse | 10 import optparse |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 def _ReadPixelExpectations(self, page): | 67 def _ReadPixelExpectations(self, page): |
68 expectations_path = os.path.join(page._base_dir, page.pixel_expectations) | 68 expectations_path = os.path.join(page._base_dir, page.pixel_expectations) |
69 with open(expectations_path, 'r') as f: | 69 with open(expectations_path, 'r') as f: |
70 json_contents = json.load(f) | 70 json_contents = json.load(f) |
71 return json_contents | 71 return json_contents |
72 | 72 |
73 | 73 |
74 class MapsPage(page.Page): | 74 class MapsPage(page.Page): |
75 def __init__(self, page_set, base_dir): | 75 def __init__(self, page_set, base_dir): |
76 super(MapsPage, self).__init__( | 76 super(MapsPage, self).__init__( |
77 url='http://localhost:10020/tracker.html', | 77 url='http://localhost:10020/tracker.html', |
78 page_set=page_set, | 78 page_set=page_set, |
79 base_dir=base_dir, | 79 base_dir=base_dir, |
80 name='Maps.maps_002') | 80 name='Maps.maps_002', |
| 81 make_javascript_deterministic=False) |
81 self.pixel_expectations = 'data/maps_002_expectations.json' | 82 self.pixel_expectations = 'data/maps_002_expectations.json' |
82 | 83 |
83 def RunNavigateSteps(self, action_runner): | 84 def RunNavigateSteps(self, action_runner): |
84 action_runner.NavigateToPage(self) | 85 action_runner.NavigateToPage(self) |
85 action_runner.WaitForJavaScriptCondition( | 86 action_runner.WaitForJavaScriptCondition( |
86 'window.testDone', timeout_in_seconds=180) | 87 'window.testDone', timeout_in_seconds=180) |
87 | 88 |
88 | 89 |
89 class Maps(cloud_storage_test_base.TestBase): | 90 class Maps(cloud_storage_test_base.TestBase): |
90 """Google Maps pixel tests.""" | 91 """Google Maps pixel tests.""" |
91 test = _MapsValidator | 92 test = _MapsValidator |
92 | 93 |
93 def CreateExpectations(self): | 94 def CreateExpectations(self): |
94 return maps_expectations.MapsExpectations() | 95 return maps_expectations.MapsExpectations() |
95 | 96 |
96 def CreatePageSet(self, options): | 97 def CreatePageSet(self, options): |
97 page_set_path = os.path.join( | 98 page_set_path = os.path.join( |
98 util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') | 99 util.GetChromiumSrcDir(), 'content', 'test', 'gpu', 'page_sets') |
99 ps = page_set.PageSet(archive_data_file='data/maps.json', | 100 ps = page_set.PageSet(archive_data_file='data/maps.json', |
100 make_javascript_deterministic=False, | |
101 file_path=page_set_path, | 101 file_path=page_set_path, |
102 bucket=page_set.PUBLIC_BUCKET) | 102 bucket=page_set.PUBLIC_BUCKET) |
103 ps.AddUserStory(MapsPage(ps, ps.base_dir)) | 103 ps.AddUserStory(MapsPage(ps, ps.base_dir)) |
104 return ps | 104 return ps |
OLD | NEW |