| OLD | NEW |
| 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 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.WaitForJavaScriptCondition( | 9 action_runner.WaitForJavaScriptCondition( |
| 10 'document.readyState == "complete"', 90) | 10 'document.readyState == "complete"', 90) |
| 11 # Rasterize only what's visible. | 11 # Rasterize only what's visible. |
| 12 action_runner.ExecuteJavaScript( | 12 action_runner.ExecuteJavaScript( |
| 13 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') | 13 'chrome.gpuBenchmarking.setRasterizeOnlyVisibleContent();') |
| 14 | 14 |
| 15 args = {} | 15 args = {} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 26 chrome.gpuBenchmarking.runMicroBenchmark( | 26 chrome.gpuBenchmarking.runMicroBenchmark( |
| 27 "invalidation_benchmark", | 27 "invalidation_benchmark", |
| 28 function(value) {}, | 28 function(value) {}, |
| 29 """ + str(args) + """ | 29 """ + str(args) + """ |
| 30 ); | 30 ); |
| 31 """) | 31 """) |
| 32 | 32 |
| 33 micro_benchmark_id = action_runner.EvaluateJavaScript( | 33 micro_benchmark_id = action_runner.EvaluateJavaScript( |
| 34 'window.benchmark_results.id') | 34 'window.benchmark_results.id') |
| 35 if not micro_benchmark_id: | 35 if not micro_benchmark_id: |
| 36 raise page_test.MeasurementFailure( | 36 raise legacy_page_test.MeasurementFailure( |
| 37 'Failed to schedule invalidation_benchmark.') | 37 'Failed to schedule invalidation_benchmark.') |
| 38 | 38 |
| 39 with action_runner.CreateInteraction('Repaint'): | 39 with action_runner.CreateInteraction('Repaint'): |
| 40 action_runner.RepaintContinuously(seconds=5) | 40 action_runner.RepaintContinuously(seconds=5) |
| 41 | 41 |
| 42 action_runner.ExecuteJavaScript(""" | 42 action_runner.ExecuteJavaScript(""" |
| 43 window.benchmark_results.message_handled = | 43 window.benchmark_results.message_handled = |
| 44 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( | 44 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( |
| 45 """ + str(micro_benchmark_id) + """, { | 45 """ + str(micro_benchmark_id) + """, { |
| 46 "notify_done": true | 46 "notify_done": true |
| 47 }); | 47 }); |
| 48 """) | 48 """) |
| OLD | NEW |