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
3 # found in the LICENSE file.
5 """Runs a Google Maps performance test.
6 Rerforms several common navigation actions on the map (pan, zoom, rotate)"""
11 from telemetry import test
12 from telemetry.core import util
13 from telemetry.page import page_measurement
14 from telemetry.page import page_set
17 class _MapsMeasurement(page_measurement.PageMeasurement):
18 def MeasurePage(self, page, tab, results):
19 js_get_results = 'document.getElementsByTagName("pre")[0].innerText'
20 test_results = tab.EvaluateJavaScript(js_get_results)
22 total = re.search('total=([0-9]+)', test_results).group(1)
23 render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2)
24 results.Add('total_time', 'ms', total)
25 results.Add('render_mean_time', 'ms', render)
28 class MapsBenchmark(test.Test):
29 """Basic Google Maps benchmarks."""
30 test = _MapsMeasurement
32 def CreatePageSet(self, options):
33 page_set_path = os.path.join(
34 util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
36 'archive_data_file': 'data/maps.json',
37 'make_javascript_deterministic': False,
40 'url': 'http://localhost:10020/tracker.html',
42 { 'action': 'navigate' },
43 { 'action': 'wait', 'javascript': 'window.testDone' }
49 return page_set.PageSet.FromDict(page_set_dict, page_set_path)
51 class MapsNoVsync(MapsBenchmark):
52 """Runs the Google Maps benchmark with Vsync disabled"""
55 def CustomizeBrowserOptions(self, options):
56 options.AppendExtraBrowserArgs('--disable-gpu-vsync')