| OLD | NEW | 
|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 import page_action | 6 from telemetry.core import util | 
| 7 from telemetry import util | 7 from telemetry.page import page_action | 
| 8 | 8 | 
| 9 class ScrollingAction(page_action.PageAction): | 9 class ScrollingAction(page_action.PageAction): | 
| 10   def __init__(self, attributes=None): | 10   def __init__(self, attributes=None): | 
| 11     super(ScrollingAction, self).__init__(attributes) | 11     super(ScrollingAction, self).__init__(attributes) | 
| 12 | 12 | 
| 13   def WillRunAction(self, page, tab): | 13   def WillRunAction(self, page, tab): | 
| 14     with open( | 14     with open( | 
| 15       os.path.join(os.path.dirname(__file__), | 15       os.path.join(os.path.dirname(__file__), | 
| 16                    'scrolling_action.js')) as f: | 16                    'scrolling_action.js')) as f: | 
| 17       js = f.read() | 17       js = f.read() | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 46 | 46 | 
| 47   def CanBeBound(self): | 47   def CanBeBound(self): | 
| 48     return True | 48     return True | 
| 49 | 49 | 
| 50   def BindMeasurementJavaScript(self, tab, start_js, stop_js): | 50   def BindMeasurementJavaScript(self, tab, start_js, stop_js): | 
| 51     # Make the scrolling action start and stop measurement automatically. | 51     # Make the scrolling action start and stop measurement automatically. | 
| 52     tab.ExecuteJavaScript(""" | 52     tab.ExecuteJavaScript(""" | 
| 53         window.__scrollingAction.beginMeasuringHook = function() { %s }; | 53         window.__scrollingAction.beginMeasuringHook = function() { %s }; | 
| 54         window.__scrollingAction.endMeasuringHook = function() { %s }; | 54         window.__scrollingAction.endMeasuringHook = function() { %s }; | 
| 55     """ % (start_js, stop_js)) | 55     """ % (start_js, stop_js)) | 
| OLD | NEW | 
|---|