Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / tools / perf / benchmarks / maps.py
blobefc42dd67aa50e16664231fddbd1f97727bbedde
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)"""
8 import os
9 import re
11 from telemetry import benchmark
12 from telemetry.core import util
13 from telemetry.page import page as page_module
14 from telemetry.page import page_set as page_set_module
15 from telemetry.page import page_test
16 from telemetry.value import scalar
19 class _MapsMeasurement(page_test.PageTest):
20 def ValidateAndMeasurePage(self, page, tab, results):
21 js_get_results = 'document.getElementsByTagName("pre")[0].innerText'
22 test_results = tab.EvaluateJavaScript(js_get_results)
24 total = re.search('total=([0-9]+)', test_results).group(1)
25 render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2)
26 results.AddValue(scalar.ScalarValue(
27 results.current_page, 'total_time', 'ms', total))
28 results.AddValue(scalar.ScalarValue(
29 results.current_page, 'render_mean_time', 'ms', render))
31 class MapsPage(page_module.Page):
32 def __init__(self, page_set, base_dir):
33 super(MapsPage, self).__init__(
34 url='http://localhost:10020/tracker.html',
35 page_set=page_set,
36 base_dir=base_dir)
38 def RunNavigateSteps(self, action_runner):
39 action_runner.NavigateToPage(self)
40 action_runner.WaitForJavaScriptCondition('window.testDone')
43 @benchmark.Disabled
44 class MapsBenchmark(benchmark.Benchmark):
45 """Basic Google Maps benchmarks."""
46 test = _MapsMeasurement
48 def CreatePageSet(self, options):
49 page_set_path = os.path.join(
50 util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
51 ps = page_set_module.PageSet(
52 archive_data_file='data/maps.json',
53 make_javascript_deterministic=False,
54 file_path=page_set_path)
55 ps.AddPage(MapsPage(ps, ps.base_dir))
56 return ps
58 class MapsNoVsync(MapsBenchmark):
59 """Runs the Google Maps benchmark with Vsync disabled"""
60 tag = 'novsync'
62 def CustomizeBrowserOptions(self, options):
63 options.AppendExtraBrowserArgs('--disable-gpu-vsync')