| 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 PageTestMeasurement |
| 5 from measurements import smoothness_controller | 6 from measurements import smoothness_controller |
| 6 from telemetry.page import page_test | 7 from telemetry.page import page_test |
| 7 | 8 |
| 8 | 9 |
| 9 class Repaint(page_test.PageTest): | 10 class Repaint(PageTestMeasurement): |
| 10 def __init__(self): | 11 def __init__(self): |
| 11 super(Repaint, self).__init__('RunRepaint', False) | 12 super(Repaint, self).__init__('RunRepaint', False) |
| 12 self._smoothness_controller = None | 13 self._smoothness_controller = None |
| 13 self._micro_benchmark_id = None | 14 self._micro_benchmark_id = None |
| 14 | 15 |
| 15 @classmethod | 16 @classmethod |
| 16 def AddCommandLineArgs(cls, parser): | 17 def AddCommandLineArgs(cls, parser): |
| 17 parser.add_option('--mode', type='string', | 18 parser.add_option('--mode', type='string', |
| 18 default='viewport', | 19 default='viewport', |
| 19 help='Invalidation mode. ' | 20 help='Invalidation mode. ' |
| 20 'Supported values: fixed_size, layer, random, viewport.') | 21 'Supported values: fixed_size, layer, random, viewport.') |
| 21 parser.add_option('--width', type='int', | 22 parser.add_option('--width', type='int', |
| 22 default=None, | 23 default=None, |
| 23 help='Width of invalidations for fixed_size mode.') | 24 help='Width of invalidations for fixed_size mode.') |
| 24 parser.add_option('--height', type='int', | 25 parser.add_option('--height', type='int', |
| 25 default=None, | 26 default=None, |
| 26 help='Height of invalidations for fixed_size mode.') | 27 help='Height of invalidations for fixed_size mode.') |
| 27 | 28 |
| 28 def CustomizeBrowserOptions(self, options): | 29 def CustomizeBrowserOptions(self, options): |
| 30 super(Repaint, self).CustomizeBrowserOptions(options) |
| 29 options.AppendExtraBrowserArgs([ | 31 options.AppendExtraBrowserArgs([ |
| 30 '--enable-impl-side-painting', | 32 '--enable-impl-side-painting', |
| 31 '--enable-threaded-compositing', | 33 '--enable-threaded-compositing', |
| 32 '--enable-gpu-benchmarking' | 34 '--enable-gpu-benchmarking' |
| 33 ]) | 35 ]) |
| 34 | 36 |
| 35 def WillRunActions(self, page, tab): | 37 def WillRunActions(self, page, tab): |
| 36 tab.WaitForDocumentReadyStateToBeComplete() | 38 tab.WaitForDocumentReadyStateToBeComplete() |
| 37 self._smoothness_controller = smoothness_controller.SmoothnessController() | 39 self._smoothness_controller = smoothness_controller.SmoothnessController() |
| 38 self._smoothness_controller.SetUp(page, tab) | 40 self._smoothness_controller.SetUp(page, tab) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 tab.ExecuteJavaScript(""" | 71 tab.ExecuteJavaScript(""" |
| 70 window.benchmark_results.message_handled = | 72 window.benchmark_results.message_handled = |
| 71 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( | 73 chrome.gpuBenchmarking.sendMessageToMicroBenchmark( |
| 72 """ + str(self._micro_benchmark_id) + """, { | 74 """ + str(self._micro_benchmark_id) + """, { |
| 73 "notify_done": true | 75 "notify_done": true |
| 74 }); | 76 }); |
| 75 """) | 77 """) |
| 76 self._smoothness_controller.Stop(tab) | 78 self._smoothness_controller.Stop(tab) |
| 77 | 79 |
| 78 def ValidateAndMeasurePage(self, page, tab, results): | 80 def ValidateAndMeasurePage(self, page, tab, results): |
| 81 super(Repaint, self).ValidateAndMeasurePage(page, tab, results) |
| 79 self._smoothness_controller.AddResults(tab, results) | 82 self._smoothness_controller.AddResults(tab, results) |
| 80 | 83 |
| 81 def CleanUpAfterPage(self, _, tab): | 84 def CleanUpAfterPage(self, _, tab): |
| 82 self._smoothness_controller.CleanUp(tab) | 85 self._smoothness_controller.CleanUp(tab) |
| OLD | NEW |