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

Unified Diff: telemetry/telemetry/core/android_action_runner.py

Issue 2822573002: Fix android_action_runner.InputSwipe and InputText (Closed)
Patch Set: Fixes. Created 3 years, 8 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/core/android_action_runner.py
diff --git a/telemetry/telemetry/core/android_action_runner.py b/telemetry/telemetry/core/android_action_runner.py
index 07fdccb71d5f7fbd24fe7cd08058013f44569ac5..7bcf29adeb4d8778f60333a30ae152b04fdf73e1 100644
--- a/telemetry/telemetry/core/android_action_runner.py
+++ b/telemetry/telemetry/core/android_action_runner.py
@@ -70,8 +70,15 @@ class AndroidActionRunner(object):
Args:
string: The string to send to the device.
"""
- self._platform_backend.device.RunShellCommand(
- ['input', 'text', string], check_return=True)
+ # Spaces should be input as keyevents since 'input text <text>' does not
+ # work with space. Pass space character to account for strings with multiple
+ # spaces.
+ words = string.split(' ')
+ for i in range(0, len(words)):
+ if i is not 0:
+ self.InputKeyEvent(keyevent.KEYCODE_SPACE)
+ self._platform_backend.device.RunShellCommand(
+ ['input', 'text', words[i]], check_return=True)
def InputKeyEvent(self, keycode):
"""Send a single key input to the device.
@@ -105,7 +112,7 @@ class AndroidActionRunner(object):
duration: The length of time of the swipe in milliseconds
"""
cmd = ['input', 'swipe']
- cmd.expand(str(x) for x in (left_start_coord, top_start_coord,
+ cmd.extend(str(x) for x in (left_start_coord, top_start_coord,
left_end_coord, top_end_coord, duration))
self._platform_backend.device.RunShellCommand(cmd, check_return=True)

Powered by Google App Engine
This is Rietveld 408576698