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

Side by Side Diff: tools/perf/measurements/repaint.py

Issue 637153002: telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Suppress pylint E1003 Created 6 years, 1 month 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 from measurements import smoothness_controller 5 from measurements import smoothness_controller
6 from telemetry.page import page_test 6 from telemetry.page import page_test
7 7
8 8
9 class Repaint(page_test.PageTest): 9 class Repaint(page_test.PageTest):
10 def __init__(self): 10 def __init__(self, mode='viewport', width=None, height=None):
11 super(Repaint, self).__init__('RunRepaint', False) 11 super(Repaint, self).__init__('RunRepaint', False)
12 self._smoothness_controller = None 12 self._smoothness_controller = None
13 self._micro_benchmark_id = None 13 self._micro_benchmark_id = None
14 14 self._mode = mode
15 @classmethod 15 self._width = width
16 def AddCommandLineArgs(cls, parser): 16 self._height = height
17 parser.add_option('--mode', type='string',
18 default='viewport',
19 help='Invalidation mode. '
20 'Supported values: fixed_size, layer, random, viewport.')
21 parser.add_option('--width', type='int',
22 default=None,
23 help='Width of invalidations for fixed_size mode.')
24 parser.add_option('--height', type='int',
25 default=None,
26 help='Height of invalidations for fixed_size mode.')
27 17
28 def CustomizeBrowserOptions(self, options): 18 def CustomizeBrowserOptions(self, options):
29 options.AppendExtraBrowserArgs([ 19 options.AppendExtraBrowserArgs([
30 '--enable-impl-side-painting', 20 '--enable-impl-side-painting',
31 '--enable-threaded-compositing', 21 '--enable-threaded-compositing',
32 '--enable-gpu-benchmarking' 22 '--enable-gpu-benchmarking'
33 ]) 23 ])
34 24
35 def WillRunActions(self, page, tab): 25 def WillRunActions(self, page, tab):
36 tab.WaitForDocumentReadyStateToBeComplete() 26 tab.WaitForDocumentReadyStateToBeComplete()
37 self._smoothness_controller = smoothness_controller.SmoothnessController() 27 self._smoothness_controller = smoothness_controller.SmoothnessController()
38 self._smoothness_controller.SetUp(page, tab) 28 self._smoothness_controller.SetUp(page, tab)
39 self._smoothness_controller.Start(tab) 29 self._smoothness_controller.Start(tab)
40 # Rasterize only what's visible. 30 # Rasterize only what's visible.
41 tab.ExecuteJavaScript( 31 tab.ExecuteJavaScript(
42 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') 32 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();')
43 33
44 args = {} 34 args = {}
45 args['mode'] = self.options.mode 35 args['mode'] = self._mode
46 if self.options.width: 36 if self._width:
47 args['width'] = self.options.width 37 args['width'] = self._width
48 if self.options.height: 38 if self._height:
49 args['height'] = self.options.height 39 args['height'] = self._height
50 40
51 # Enque benchmark 41 # Enque benchmark
52 tab.ExecuteJavaScript(""" 42 tab.ExecuteJavaScript("""
53 window.benchmark_results = {}; 43 window.benchmark_results = {};
54 window.benchmark_results.id = 44 window.benchmark_results.id =
55 chrome.gpuBenchmarking.runMicroBenchmark( 45 chrome.gpuBenchmarking.runMicroBenchmark(
56 "invalidation_benchmark", 46 "invalidation_benchmark",
57 function(value) {}, 47 function(value) {},
58 """ + str(args) + """ 48 """ + str(args) + """
59 ); 49 );
(...skipping 13 matching lines...) Expand all
73 "notify_done": true 63 "notify_done": true
74 }); 64 });
75 """) 65 """)
76 self._smoothness_controller.Stop(tab) 66 self._smoothness_controller.Stop(tab)
77 67
78 def ValidateAndMeasurePage(self, page, tab, results): 68 def ValidateAndMeasurePage(self, page, tab, results):
79 self._smoothness_controller.AddResults(tab, results) 69 self._smoothness_controller.AddResults(tab, results)
80 70
81 def CleanUpAfterPage(self, _, tab): 71 def CleanUpAfterPage(self, _, tab):
82 self._smoothness_controller.CleanUp(tab) 72 self._smoothness_controller.CleanUp(tab)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698