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

Side by Side Diff: tools/perf/page_sets/repaint_helpers.py

Issue 2719853003: [Telemetry refactor] Drop "2" from method calls to JS API (Closed)
Patch Set: Created 3 years, 9 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 | « tools/perf/page_sets/polymer.py ('k') | tools/perf/page_sets/service_worker_micro_benchmark.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 telemetry.page import legacy_page_test 5 from telemetry.page import legacy_page_test
6 6
7 7
8 def Repaint(action_runner, mode='viewport', width=None, height=None): 8 def Repaint(action_runner, mode='viewport', width=None, height=None):
9 action_runner.WaitForJavaScriptCondition2( 9 action_runner.WaitForJavaScriptCondition(
10 'document.readyState == "complete"', timeout=90) 10 'document.readyState == "complete"', timeout=90)
11 # Rasterize only what's visible. 11 # Rasterize only what's visible.
12 action_runner.ExecuteJavaScript2( 12 action_runner.ExecuteJavaScript(
13 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') 13 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();')
14 14
15 args = {} 15 args = {}
16 args['mode'] = mode 16 args['mode'] = mode
17 if width: 17 if width:
18 args['width'] = width 18 args['width'] = width
19 if height: 19 if height:
20 args['height'] = height 20 args['height'] = height
21 21
22 # Enqueue benchmark 22 # Enqueue benchmark
23 action_runner.ExecuteJavaScript2(""" 23 action_runner.ExecuteJavaScript("""
24 window.benchmark_results = {}; 24 window.benchmark_results = {};
25 window.benchmark_results.id = 25 window.benchmark_results.id =
26 chrome.gpuBenchmarking.runMicroBenchmark( 26 chrome.gpuBenchmarking.runMicroBenchmark(
27 "invalidation_benchmark", 27 "invalidation_benchmark",
28 function(value) {}, 28 function(value) {},
29 {{ args }} 29 {{ args }}
30 ); 30 );
31 """, 31 """,
32 args=args) 32 args=args)
33 33
34 micro_benchmark_id = action_runner.EvaluateJavaScript2( 34 micro_benchmark_id = action_runner.EvaluateJavaScript(
35 'window.benchmark_results.id') 35 'window.benchmark_results.id')
36 if not micro_benchmark_id: 36 if not micro_benchmark_id:
37 raise legacy_page_test.MeasurementFailure( 37 raise legacy_page_test.MeasurementFailure(
38 'Failed to schedule invalidation_benchmark.') 38 'Failed to schedule invalidation_benchmark.')
39 39
40 with action_runner.CreateInteraction('Repaint'): 40 with action_runner.CreateInteraction('Repaint'):
41 action_runner.RepaintContinuously(seconds=5) 41 action_runner.RepaintContinuously(seconds=5)
42 42
43 action_runner.ExecuteJavaScript2(""" 43 action_runner.ExecuteJavaScript("""
44 window.benchmark_results.message_handled = 44 window.benchmark_results.message_handled =
45 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( 45 chrome.gpuBenchmarking.sendMessageToMicroBenchmark(
46 {{ micro_benchmark_id }}, { 46 {{ micro_benchmark_id }}, {
47 "notify_done": true 47 "notify_done": true
48 }); 48 });
49 """, 49 """,
50 micro_benchmark_id=micro_benchmark_id) 50 micro_benchmark_id=micro_benchmark_id)
51 51
52 52
53 def WaitThenRepaint(action_runner): 53 def WaitThenRepaint(action_runner):
54 action_runner.Wait(2) 54 action_runner.Wait(2)
55 Repaint(action_runner) 55 Repaint(action_runner)
OLDNEW
« no previous file with comments | « tools/perf/page_sets/polymer.py ('k') | tools/perf/page_sets/service_worker_micro_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698