Index: tools/telemetry/telemetry/scrolling_action.py |
diff --git a/tools/telemetry/telemetry/scrolling_action.py b/tools/telemetry/telemetry/scrolling_action.py |
deleted file mode 100644 |
index 01ef3591c12fcd04a7591f9f4a3c487b7821e31a..0000000000000000000000000000000000000000 |
--- a/tools/telemetry/telemetry/scrolling_action.py |
+++ /dev/null |
@@ -1,55 +0,0 @@ |
-# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
-# Use of this source code is governed by a BSD-style license that can be |
-# found in the LICENSE file. |
-import os |
- |
-from telemetry import page_action |
-from telemetry import util |
- |
-class ScrollingAction(page_action.PageAction): |
- def __init__(self, attributes=None): |
- super(ScrollingAction, self).__init__(attributes) |
- |
- def WillRunAction(self, page, tab): |
- with open( |
- os.path.join(os.path.dirname(__file__), |
- 'scrolling_action.js')) as f: |
- js = f.read() |
- tab.ExecuteJavaScript(js) |
- |
- tab.ExecuteJavaScript(""" |
- window.__scrollingActionDone = false; |
- window.__scrollingAction = new __ScrollingAction(function() { |
- window.__scrollingActionDone = true; |
- }); |
- """) |
- |
- def RunAction(self, page, tab, previous_action): |
- with tab.browser.platform.GetSurfaceCollector(''): |
- # scrollable_element_function is a function that passes the scrollable |
- # element on the page to a callback. For example: |
- # function (callback) { |
- # callback(document.getElementById('foo')); |
- # } |
- if hasattr(self, 'scrollable_element_function'): |
- tab.ExecuteJavaScript(""" |
- (%s)(function(element) { |
- window.__scrollingAction.start(element); |
- });""" % (self.scrollable_element_function)) |
- else: |
- tab.ExecuteJavaScript( |
- 'window.__scrollingAction.start(document.body);') |
- |
- # Poll for scroll benchmark completion. |
- util.WaitFor(lambda: tab.EvaluateJavaScript( |
- 'window.__scrollingActionDone'), 60) |
- |
- def CanBeBound(self): |
- return True |
- |
- def BindMeasurementJavaScript(self, tab, start_js, stop_js): |
- # Make the scrolling action start and stop measurement automatically. |
- tab.ExecuteJavaScript(""" |
- window.__scrollingAction.beginMeasuringHook = function() { %s }; |
- window.__scrollingAction.endMeasuringHook = function() { %s }; |
- """ % (start_js, stop_js)) |