summaryrefslogtreecommitdiffstats
path: root/tools/telemetry
diff options
context:
space:
mode:
authorepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 07:54:01 +0000
committerepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-10 07:54:01 +0000
commita2bbb3a5060d98d7ce09fea74be26006aafbee35 (patch)
tree3123730dccbe4944cfad815e5f3c35429789a106 /tools/telemetry
parent2970d53e5fc127f3e065f0a3dcea42984bbc4d4f (diff)
downloadchromium_src-a2bbb3a5060d98d7ce09fea74be26006aafbee35.zip
chromium_src-a2bbb3a5060d98d7ce09fea74be26006aafbee35.tar.gz
chromium_src-a2bbb3a5060d98d7ce09fea74be26006aafbee35.tar.bz2
Telemetry: Fix/Add Groupcloned/News JS-scroll benchmarks.
The allows overriding the remaining scroll distance, which can then be assigned to element's locations that move in response to javascript-driven 'scrolling'. This allows us to scroll sites like Groupcloned.com and News. BUG=249416,223726 Review URL: https://chromiumcodereview.appspot.com/18534003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/telemetry')
-rw-r--r--tools/telemetry/telemetry/page/actions/scroll.js6
-rw-r--r--tools/telemetry/telemetry/page/actions/scroll.py19
2 files changed, 20 insertions, 5 deletions
diff --git a/tools/telemetry/telemetry/page/actions/scroll.js b/tools/telemetry/telemetry/page/actions/scroll.js
index de52fd6..66ad50c 100644
--- a/tools/telemetry/telemetry/page/actions/scroll.js
+++ b/tools/telemetry/telemetry/page/actions/scroll.js
@@ -91,16 +91,20 @@
//
// start -> startPass_ -> ...scroll... -> onGestureComplete_ ->
// -> startPass_ -> .. scroll... -> onGestureComplete_ -> callback_
- function ScrollAction(opt_callback) {
+ function ScrollAction(opt_callback, opt_remaining_distance_func) {
var self = this;
this.beginMeasuringHook = function() {}
this.endMeasuringHook = function() {}
this.callback_ = opt_callback;
+ this.remaining_distance_func_ = opt_remaining_distance_func;
}
ScrollAction.prototype.getRemainingScrollDistance_ = function() {
+ if (this.remaining_distance_func_)
+ return this.remaining_distance_func_();
+
var clientHeight;
// clientHeight is "special" for the body element.
if (this.element_ == document.body)
diff --git a/tools/telemetry/telemetry/page/actions/scroll.py b/tools/telemetry/telemetry/page/actions/scroll.py
index 70d237a..d6266f4 100644
--- a/tools/telemetry/telemetry/page/actions/scroll.py
+++ b/tools/telemetry/telemetry/page/actions/scroll.py
@@ -17,12 +17,23 @@ class ScrollAction(page_action.PageAction):
js = f.read()
tab.ExecuteJavaScript(js)
+ # Fail if this action requires touch and we can't send touch events.
+ if (hasattr(self, 'scroll_requires_touch') and
+ self.scroll_requires_touch and not
+ tab.EvaluateJavaScript(
+ 'chrome.gpuBenchmarking.smoothScrollBySendsTouch()')):
+ raise page_action.PageActionNotSupported(
+ 'Touch scroll not supported for this browser')
+
+ distance_func = 'null'
+ if hasattr(self, 'remaining_scroll_distance_function'):
+ distance_func = self.remaining_scroll_distance_function
+
+ done_callback = 'function() { window.__scrollActionDone = true; }'
tab.ExecuteJavaScript("""
window.__scrollActionDone = false;
- window.__scrollAction = new __ScrollAction(function() {
- window.__scrollActionDone = true;
- });
- """)
+ window.__scrollAction = new __ScrollAction(%s, %s);"""
+ % (done_callback, distance_func))
def RunAction(self, page, tab, previous_action):
# scrollable_element_function is a function that passes the scrollable