OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from telemetry.page import page_test |
| 6 |
| 7 |
| 8 def Repaint(action_runner, mode='viewport', width=None, height=None): |
| 9 # Rasterize only what's visible. |
| 10 action_runner.ExecuteJavaScript( |
| 11 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') |
| 12 |
| 13 args = {} |
| 14 args['mode'] = mode |
| 15 if width: |
| 16 args['width'] = width |
| 17 if height: |
| 18 args['height'] = height |
| 19 |
| 20 # Enque benchmark |
| 21 action_runner.ExecuteJavaScript(""" |
| 22 window.benchmark_results = {}; |
| 23 window.benchmark_results.id = |
| 24 chrome.gpuBenchmarking.runMicroBenchmark( |
| 25 "invalidation_benchmark", |
| 26 function(value) {}, |
| 27 """ + str(args) + """ |
| 28 ); |
| 29 """) |
| 30 |
| 31 micro_benchmark_id = action_runner.EvaluateJavaScript( |
| 32 'window.benchmark_results.id') |
| 33 if (not micro_benchmark_id): |
| 34 raise page_test.MeasurementFailure( |
| 35 'Failed to schedule invalidation_benchmark.') |
| 36 |
| 37 with action_runner.CreateInteraction('Repaint'): |
| 38 action_runner.RepaintContinuously(seconds=5) |
| 39 |
| 40 action_runner.ExecuteJavaScript(""" |
| 41 window.benchmark_results.message_handled = |
| 42 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( |
| 43 """ + str(micro_benchmark_id) + """, { |
| 44 "notify_done": true |
| 45 }); |
| 46 """) |
OLD | NEW |