Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: tools/perf/benchmarks/maps.py

Issue 251673002: Get rid of PageSet.FromDict in perf/benchmark/maps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lint Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 performance test. 5 """Runs a Google Maps performance test.
6 Rerforms several common navigation actions on the map (pan, zoom, rotate)""" 6 Rerforms several common navigation actions on the map (pan, zoom, rotate)"""
7 7
8 import os 8 import os
9 import re 9 import re
10 10
11 from telemetry import test 11 from telemetry import test
12 from telemetry.core import util 12 from telemetry.core import util
13 from telemetry.page import page_measurement 13 from telemetry.page import page_measurement
14 from telemetry.page import page_set 14 from telemetry.page import page as page_module
15 from telemetry.page import page_set as page_set_module
16 # pylint: disable=W0401,W0614
17 from telemetry.page.actions.all_page_actions import *
15 18
16 19
17 class _MapsMeasurement(page_measurement.PageMeasurement): 20 class _MapsMeasurement(page_measurement.PageMeasurement):
18 def MeasurePage(self, page, tab, results): 21 def MeasurePage(self, page, tab, results):
19 js_get_results = 'document.getElementsByTagName("pre")[0].innerText' 22 js_get_results = 'document.getElementsByTagName("pre")[0].innerText'
20 test_results = tab.EvaluateJavaScript(js_get_results) 23 test_results = tab.EvaluateJavaScript(js_get_results)
21 24
22 total = re.search('total=([0-9]+)', test_results).group(1) 25 total = re.search('total=([0-9]+)', test_results).group(1)
23 render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2) 26 render = re.search('render=([0-9.]+),([0-9.]+)', test_results).group(2)
24 results.Add('total_time', 'ms', total) 27 results.Add('total_time', 'ms', total)
25 results.Add('render_mean_time', 'ms', render) 28 results.Add('render_mean_time', 'ms', render)
26 29
30 class MapsPage(page_module.Page):
31 def __init__(self, page_set, base_dir):
32 super(MapsPage, self).__init__(
33 url='http://localhost:10020/tracker.html',
34 page_set=page_set,
35 base_dir=base_dir)
36
37 def RunNavigateSteps(self, action_runner):
38 action_runner.Run(NavigateAction())
39 action_runner.Run(WaitAction({'javascript': 'window.testDone'}))
40
41
27 @test.Disabled 42 @test.Disabled
28 class MapsBenchmark(test.Test): 43 class MapsBenchmark(test.Test):
29 """Basic Google Maps benchmarks.""" 44 """Basic Google Maps benchmarks."""
30 test = _MapsMeasurement 45 test = _MapsMeasurement
31 46
32 def CreatePageSet(self, options): 47 def CreatePageSet(self, options):
33 page_set_path = os.path.join( 48 page_set_path = os.path.join(
34 util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets') 49 util.GetChromiumSrcDir(), 'tools', 'perf', 'page_sets')
35 page_set_dict = { 50 ps = page_set_module.PageSet(
36 'archive_data_file': 'data/maps.json', 51 archive_data_file='data/maps.json',
37 'make_javascript_deterministic': False, 52 make_javascript_deterministic=False,
38 'pages': [ 53 file_path=page_set_path)
39 { 54 ps.AddPage(MapsPage(ps, ps.base_dir))
40 'url': 'http://localhost:10020/tracker.html', 55 return ps
41 'navigate_steps' : [
42 { 'action': 'navigate' },
43 { 'action': 'wait', 'javascript': 'window.testDone' }
44 ]
45 }
46 ]
47 }
48
49 return page_set.PageSet.FromDict(page_set_dict, page_set_path)
50 56
51 class MapsNoVsync(MapsBenchmark): 57 class MapsNoVsync(MapsBenchmark):
52 """Runs the Google Maps benchmark with Vsync disabled""" 58 """Runs the Google Maps benchmark with Vsync disabled"""
53 tag = 'novsync' 59 tag = 'novsync'
54 60
55 def CustomizeBrowserOptions(self, options): 61 def CustomizeBrowserOptions(self, options):
56 options.AppendExtraBrowserArgs('--disable-gpu-vsync') 62 options.AppendExtraBrowserArgs('--disable-gpu-vsync')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698