Add support for escaped target names in isolate driver (4th try)
[chromium-blink-merge.git] / tools / perf / benchmarks / maps.py
blob692459212f631a548c18f90ba150a665719a633f
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 core import perf_benchmark
13 from telemetry import benchmark
14 from telemetry.core import util
15 from telemetry.page import page as page_module
16 from telemetry.page import page_test
17 from telemetry import story
18 from telemetry.value import scalar
21 class _MapsMeasurement(page_test.PageTest):
22 def __init__(self):
23 super(_MapsMeasurement, self).__init__()
25 def ValidateAndMeasurePage(self, page, tab, results):
26 js_get_results = 'document.getElementsByTagName("pre")[0].innerText'
27 test_results = tab.EvaluateJavaScript(js_get_results)
29 total = re.search('total=([0-9]+)', test_results).group(1)
30 render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2)
31 results.AddValue(scalar.ScalarValue(
32 results.current_page, 'total_time', 'ms', int(total)))
33 results.AddValue(scalar.ScalarValue(
34 results.current_page, 'render_mean_time', 'ms', float(render)))
36 class MapsPage(page_module.Page):
37 def __init__(self, page_set, base_dir):
38 super(MapsPage, self).__init__(
39 url='http://localhost:10020/tracker.html',
40 page_set=page_set,
41 base_dir=base_dir,
42 make_javascript_deterministic=False)
44 def RunNavigateSteps(self, action_runner):
45 super(MapsPage, self).RunNavigateSteps(action_runner)
46 action_runner.WaitForJavaScriptCondition('window.testDone')
49 @benchmark.Disabled
50 class MapsBenchmark(perf_benchmark.PerfBenchmark):
51 """Basic Google Maps benchmarks."""
52 test = _MapsMeasurement
54 @classmethod
55 def Name(cls):
56 return 'maps'
58 def CreateStorySet(self, options):
59 page_set_path = os.path.join(
60 util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
61 ps = story.StorySet(
62 archive_data_file='data/maps.json', base_dir=page_set_path,
63 cloud_storage_bucket=story.PUBLIC_BUCKET)
64 ps.AddStory(MapsPage(ps, ps.base_dir))
65 return ps
67 class MapsNoVsync(MapsBenchmark):
68 """Runs the Google Maps benchmark with Vsync disabled"""
69 tag = 'novsync'
71 @classmethod
72 def Name(cls):
73 return 'maps.novsync'
75 def SetExtraBrowserOptions(self, options):
76 options.AppendExtraBrowserArgs('--disable-gpu-vsync')