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 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
):
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',
42 make_javascript_deterministic
=False)
44 def RunNavigateSteps(self
, action_runner
):
45 super(MapsPage
, self
).RunNavigateSteps(action_runner
)
46 action_runner
.WaitForJavaScriptCondition('window.testDone')
50 class MapsBenchmark(perf_benchmark
.PerfBenchmark
):
51 """Basic Google Maps benchmarks."""
52 test
= _MapsMeasurement
58 def CreateStorySet(self
, options
):
59 page_set_path
= os
.path
.join(
60 util
.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
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
))
67 class MapsNoVsync(MapsBenchmark
):
68 """Runs the Google Maps benchmark with Vsync disabled"""
75 def SetExtraBrowserOptions(self
, options
):
76 options
.AppendExtraBrowserArgs('--disable-gpu-vsync')