Chromium Code Reviews| Index: telemetry/telemetry/internal/actions/action_runner.py |
| diff --git a/telemetry/telemetry/internal/actions/action_runner.py b/telemetry/telemetry/internal/actions/action_runner.py |
| index ec2a5eac8e28db8da31ed2c215a0baed16a7f38d..1478562cbc7914e39a390488a51c290cd62a4c96 100644 |
| --- a/telemetry/telemetry/internal/actions/action_runner.py |
| +++ b/telemetry/telemetry/internal/actions/action_runner.py |
| @@ -416,8 +416,10 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| document.body. |
| - direction: The direction of scroll, either 'left', 'right', |
| - 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright' |
| + direction: The direction of scroll, it can be either 'left', 'right', |
| + 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright'. |
| + To increase scrollTop use the 'down' direction with positive |
| + distance. |
| distance: The distance to scroll (in pixel). |
| distance_expr: A JavaScript expression (as string) that can be |
| evaluated to compute scroll distance. Example: |
| @@ -520,8 +522,10 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| the element. |
| - direction: The direction of scroll, either 'left', 'right', |
| + direction: The direction of scroll, it can be either 'left', 'right', |
| 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright' |
| + To increase scrollTop use the 'down' direction with positive |
| + distance. |
| distance: The distance to scroll (in pixel). |
| distance_expr: A JavaScript expression (as string) that can be |
| evaluated to compute scroll distance. Example: |
| @@ -557,8 +561,10 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| document.body. |
| - direction: The direction of scroll, either 'left', 'right', |
| - 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright' |
| + direction: The direction of scroll, it can be either 'left', 'right', |
| + 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright'. |
| + To increase scrollTop use the 'down' direction with positive |
| + distance. |
| distance: The distance to scroll (in pixel). |
| overscroll: The number of additional pixels to scroll back, in |
| addition to the givendistance. |
| @@ -596,8 +602,10 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| document.body. |
| - direction: The direction of scroll, either 'left', 'right', |
| + direction: The direction of scroll, it can be either 'left', 'right', |
| 'up', 'down', 'upleft', 'upright', 'downleft', or 'downright' |
| + To increase scrollTop use the 'down' direction with positive |
| + distance. |
| distance: The distance to scroll (in pixel). |
| overscroll: The number of additional pixels to scroll back, in |
| addition to the given distance. |
| @@ -620,7 +628,9 @@ class ActionRunner(object): |
| self._RunAction(MouseClickAction(selector=selector)) |
| def SwipePage(self, left_start_ratio=0.5, top_start_ratio=0.5, |
| - direction='left', distance=100, speed_in_pixels_per_second=800): |
| + direction='right', distance=100, speed_in_pixels_per_second=800, |
| + synthetic_gesture_source=GESTURE_SOURCE_DEFAULT, velocity_x=0, |
| + velocity_y=0): |
| """Perform swipe gesture on the page. |
| Args: |
| @@ -630,20 +640,30 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| document.body. |
| - direction: The direction of swipe, either 'left', 'right', |
| - 'up', or 'down' |
| + direction: The direction of swipe, it can be either 'left', 'right', |
| + 'up', or 'down'. To increase scrollLeft use the 'right' direction |
| + with positive distance. |
| distance: The distance to swipe (in pixel). |
| speed_in_pixels_per_second: The speed of the gesture (in pixels/s). |
| + synthetic_gesture_source: the source input device type for the |
| + synthetic gesture: 'DEFAULT', 'TOUCH' or 'MOUSE'. |
| + velocity_x, velocity_y: Fling velocities for touchpad swipe |
|
nednguyen
2017/04/26 20:17:35
Hmhh, could this cause conflict with speed_in_pixe
|
| + (source = 'MOUSE'). |
| """ |
| + assert synthetic_gesture_source in SUPPORTED_GESTURE_SOURCES |
| self._RunAction(SwipeAction( |
| left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio, |
| direction=direction, distance=distance, |
| - speed_in_pixels_per_second=speed_in_pixels_per_second)) |
| + speed_in_pixels_per_second=speed_in_pixels_per_second, |
| + synthetic_gesture_source=synthetic_gesture_source, |
| + velocity_x=velocity_x, velocity_y=velocity_y)) |
| def SwipeElement(self, selector=None, text=None, element_function=None, |
| left_start_ratio=0.5, top_start_ratio=0.5, |
| - direction='left', distance=100, |
| - speed_in_pixels_per_second=800): |
| + direction='right', distance=100, |
| + speed_in_pixels_per_second=800, |
| + synthetic_gesture_source=GESTURE_SOURCE_DEFAULT, |
| + velocity_x=0, velocity_y=0): |
| """Perform swipe gesture on the element. |
| The element may be selected via selector, text, or element_function. |
| @@ -661,16 +681,24 @@ class ActionRunner(object): |
| top_start_ratio: The vertical starting coordinate of the |
| gesture, as a ratio of the visible bounding rectangle for |
| the element. |
| - direction: The direction of swipe, either 'left', 'right', |
| - 'up', or 'down' |
| + direction: The direction of swipe, it can be either 'left', 'right', |
| + 'up', or 'down'. To increase scrollLeft use the 'right' direction |
| + with positive distance. |
| distance: The distance to swipe (in pixel). |
| speed_in_pixels_per_second: The speed of the gesture (in pixels/s). |
| + synthetic_gesture_source: the source input device type for the |
| + synthetic gesture: 'DEFAULT', 'TOUCH' or 'MOUSE'. |
| + velocity_x, velocity_y: Fling velocities for touchpad swipe |
| + (source = 'MOUSE'). |
| """ |
| + assert synthetic_gesture_source in SUPPORTED_GESTURE_SOURCES |
| self._RunAction(SwipeAction( |
| selector=selector, text=text, element_function=element_function, |
| left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio, |
| direction=direction, distance=distance, |
| - speed_in_pixels_per_second=speed_in_pixels_per_second)) |
| + speed_in_pixels_per_second=speed_in_pixels_per_second, |
| + synthetic_gesture_source=synthetic_gesture_source, |
| + velocity_x=velocity_x, velocity_y=velocity_y)) |
| def PressKey(self, key, repeat_count=1, repeat_delay_ms=100, timeout=60): |
| """Perform a key press. |