Index: tools/telemetry/telemetry/page/actions/action_runner.py |
diff --git a/tools/telemetry/telemetry/page/actions/action_runner.py b/tools/telemetry/telemetry/page/actions/action_runner.py |
index f615f98b862f990f36ea8dd5780bab072b9d7ea9..d99af21b75711ecf9eeb7bd711b4ad8db9f1868f 100644 |
--- a/tools/telemetry/telemetry/page/actions/action_runner.py |
+++ b/tools/telemetry/telemetry/page/actions/action_runner.py |
@@ -6,6 +6,7 @@ import time |
import logging |
import urlparse |
+from telemetry.page.actions.drag import DragAction |
from telemetry.page.actions.javascript_click import ClickElementAction |
from telemetry.page.actions.loop import LoopAction |
from telemetry.page.actions.mouse_click import MouseClickAction |
@@ -239,6 +240,35 @@ class ActionRunner(object): |
self._RunAction(ClickElementAction( |
selector=selector, text=text, element_function=element_function)) |
+ def DragPage(self, left_start_ratio, top_start_ratio, left_end_ratio, |
+ top_end_ratio, speed_in_pixels_per_second=800, use_touch=False): |
+ """Perform drag gesture on the page. |
petrcermak
2015/02/25 11:35:48
nit: "... a drag gesture ..."
ssid
2015/02/27 11:35:15
Done.
|
+ |
+ You should specify a start and an end point in ratios of page width and |
+ height respectively (see drag.js for full implementation). |
petrcermak
2015/02/25 11:35:48
I don't think "respectively" belongs here. It sugg
ssid
2015/02/27 11:35:15
Done.
|
+ |
+ Args: |
+ left_start_ratio: The horizontal starting coordinate of the |
+ gesture, as a ratio of the visible bounding rectangle for |
petrcermak
2015/02/25 11:35:48
nit: [Take this only as an opinion] I would person
ssid
2015/02/27 11:35:15
keeping this consistent with the file.
|
+ document.body. |
+ top_start_ratio: The vertical starting coordinate of the |
+ gesture, as a ratio of the visible bounding rectangle for |
+ document.body. |
+ left_end_ratio: The horizontal ending coordinate of the |
+ gesture, as a ratio of the visible bounding rectangle for |
+ document.body. |
+ top_end_ratio: The vertical ending coordinate of the |
+ gesture, as a ratio of the visible bounding rectangle for |
+ document.body. |
+ speed_in_pixels_per_second: The speed of the gesture (in pixels/s). |
+ use_touch: Whether dragging should be done with touch input. |
+ """ |
+ self._RunAction(DragAction( |
+ left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio, |
petrcermak
2015/02/25 11:35:48
I would suggest putting every argument on a single
ssid
2015/02/27 11:35:15
Keeping this consistent with the style in file.
|
+ left_end_ratio=left_end_ratio, top_end_ratio=top_end_ratio, |
+ speed_in_pixels_per_second=speed_in_pixels_per_second, |
+ use_touch=use_touch)) |
+ |
def PinchPage(self, left_anchor_ratio=0.5, top_anchor_ratio=0.5, |
scale_factor=None, speed_in_pixels_per_second=800): |
"""Perform the pinch gesture on the page. |