Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: tools/telemetry/telemetry/scrolling_action.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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))
« no previous file with comments | « tools/telemetry/telemetry/scrolling_action.js ('k') | tools/telemetry/telemetry/scrolling_action_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698