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 measurements import smoothness_controller | 5 from measurements import smoothness_controller |
6 from telemetry.page import page_measurement | 6 from telemetry.page import page_test |
7 | 7 |
8 | 8 |
9 class Repaint(page_measurement.PageMeasurement): | 9 class Repaint(page_test.PageTest): |
10 def __init__(self): | 10 def __init__(self): |
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 |
15 @classmethod | 15 @classmethod |
16 def AddCommandLineArgs(cls, parser): | 16 def AddCommandLineArgs(cls, parser): |
17 parser.add_option('--mode', type='string', | 17 parser.add_option('--mode', type='string', |
18 default='viewport', | 18 default='viewport', |
19 help='Invalidation mode. ' | 19 help='Invalidation mode. ' |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 chrome.gpuBenchmarking.runMicroBenchmark( | 55 chrome.gpuBenchmarking.runMicroBenchmark( |
56 "invalidation_benchmark", | 56 "invalidation_benchmark", |
57 function(value) {}, | 57 function(value) {}, |
58 """ + str(args) + """ | 58 """ + str(args) + """ |
59 ); | 59 ); |
60 """) | 60 """) |
61 | 61 |
62 self._micro_benchmark_id = tab.EvaluateJavaScript( | 62 self._micro_benchmark_id = tab.EvaluateJavaScript( |
63 'window.benchmark_results.id') | 63 'window.benchmark_results.id') |
64 if (not self._micro_benchmark_id): | 64 if (not self._micro_benchmark_id): |
65 raise page_measurement.MeasurementFailure( | 65 raise page_test.MeasurementFailure( |
66 'Failed to schedule invalidation_benchmark.') | 66 'Failed to schedule invalidation_benchmark.') |
67 | 67 |
68 def DidRunActions(self, page, tab): | 68 def DidRunActions(self, page, tab): |
69 tab.ExecuteJavaScript(""" | 69 tab.ExecuteJavaScript(""" |
70 window.benchmark_results.message_handled = | 70 window.benchmark_results.message_handled = |
71 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( | 71 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( |
72 """ + str(self._micro_benchmark_id) + """, { | 72 """ + str(self._micro_benchmark_id) + """, { |
73 "notify_done": true | 73 "notify_done": true |
74 }); | 74 }); |
75 """) | 75 """) |
76 self._smoothness_controller.Stop(tab) | 76 self._smoothness_controller.Stop(tab) |
77 | 77 |
78 def MeasurePage(self, page, tab, results): | 78 def MeasurePage(self, page, tab, results): |
79 self._smoothness_controller.AddResults(tab, results) | 79 self._smoothness_controller.AddResults(tab, results) |
80 | 80 |
81 def CleanUpAfterPage(self, _, tab): | 81 def CleanUpAfterPage(self, _, tab): |
82 self._smoothness_controller.CleanUp(tab) | 82 self._smoothness_controller.CleanUp(tab) |
OLD | NEW |