| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 2012 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 import os | 4 import os |
| 5 | 5 |
| 6 from telemetry.page.actions.gesture_action import GestureAction | 6 from telemetry.page.actions.gesture_action import GestureAction |
| 7 from telemetry.page.actions import page_action | 7 from telemetry.page.actions import page_action |
| 8 | 8 |
| 9 class ScrollAction(GestureAction): | 9 class ScrollAction(GestureAction): |
| 10 def __init__(self, attributes=None): | 10 def __init__(self, attributes=None): |
| 11 super(ScrollAction, self).__init__(attributes) | 11 super(ScrollAction, self).__init__(attributes) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 def CanBeBound(self): | 102 def CanBeBound(self): |
| 103 return True | 103 return True |
| 104 | 104 |
| 105 def BindMeasurementJavaScript(self, tab, start_js, stop_js): | 105 def BindMeasurementJavaScript(self, tab, start_js, stop_js): |
| 106 # Make the scroll action start and stop measurement automatically. | 106 # Make the scroll action start and stop measurement automatically. |
| 107 tab.ExecuteJavaScript(""" | 107 tab.ExecuteJavaScript(""" |
| 108 window.__scrollAction.beginMeasuringHook = function() { %s }; | 108 window.__scrollAction.beginMeasuringHook = function() { %s }; |
| 109 window.__scrollAction.endMeasuringHook = function() { %s }; | 109 window.__scrollAction.endMeasuringHook = function() { %s }; |
| 110 """ % (start_js, stop_js)) | 110 """ % (start_js, stop_js)) |
| OLD | NEW |