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

Unified Diff: telemetry/telemetry/internal/actions/repeatable_scroll.py

Issue 2138883002: Fix computation of scroll amount in scroll actions. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Address comments Created 4 years, 5 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: telemetry/telemetry/internal/actions/repeatable_scroll.py
diff --git a/telemetry/telemetry/internal/actions/repeatable_scroll.py b/telemetry/telemetry/internal/actions/repeatable_scroll.py
index 3e5f36e355f5877a37719918981fdd5d1f1236bb..9ed09e061ec1e72de2f703b7c63f19be7b408c8e 100644
--- a/telemetry/telemetry/internal/actions/repeatable_scroll.py
+++ b/telemetry/telemetry/internal/actions/repeatable_scroll.py
@@ -2,7 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import numbers
+
from telemetry.internal.actions import page_action
+from telemetry.internal.actions import utils
from telemetry.web_perf import timeline_interaction_record
@@ -22,11 +25,13 @@ class RepeatableScrollAction(page_action.PageAction):
self._speed = speed
def WillRunAction(self, tab):
+ utils.InjectJavaScript(tab, 'gesture_common.js')
# Get the dimensions of the screen.
- window_info_js = 'window.innerWidth + "," + window.innerHeight'
- js_result = tab.EvaluateJavaScript(window_info_js).split(',')
-
- self._windowsize = [int(js_result[0]), int(js_result[1])]
+ self._windowsize = tab.EvaluateJavaScript(
+ '[__GestureCommon_GetWindowWidth(),'
+ ' __GestureCommon_GetWindowHeight()]')
+ assert len(self._windowsize) == 2
+ assert all(isinstance(d, numbers.Number) for d in self._windowsize)
def RunAction(self, tab):
# Set up a browser driven repeating scroll. The delay between the scrolls
« no previous file with comments | « telemetry/telemetry/internal/actions/play.py ('k') | telemetry/telemetry/internal/actions/repeatable_scroll_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698