aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkjin <kjin@google.com>2016-10-28 10:07:53 -0700
committerKevin Jin <kjin@google.com>2017-02-17 14:42:00 -0800
commit0fad39b89d74210ae77a2321d4a8afcf5a5511e2 (patch)
treef72ccd7a725d722adc95c4a48f5e2b0cd4ad8593
parent366ded91d7e63e4309ffb9ff393588674c3e7da0 (diff)
downloaddroiddriver-0fad39b89d74210ae77a2321d4a8afcf5a5511e2.tar.gz
Rigorously check TextAction's injection
This makes it consistent with SingleKeyAction ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137522932
-rw-r--r--src/io/appium/droiddriver/actions/TextAction.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/io/appium/droiddriver/actions/TextAction.java b/src/io/appium/droiddriver/actions/TextAction.java
index b108b00..28565e8 100644
--- a/src/io/appium/droiddriver/actions/TextAction.java
+++ b/src/io/appium/droiddriver/actions/TextAction.java
@@ -59,7 +59,6 @@ public class TextAction extends KeyAction {
// TODO: recycle events?
KeyEvent[] events = KEY_CHAR_MAP.getEvents(text.toCharArray());
- boolean success = false;
if (events != null) {
for (KeyEvent event : events) {
@@ -69,15 +68,14 @@ public class TextAction extends KeyAction {
// possible for an event to become stale before it is injected if it
// takes too long to inject the preceding ones.
KeyEvent modifiedEvent = KeyEvent.changeTimeRepeat(event, SystemClock.uptimeMillis(), 0);
- success = injector.injectInputEvent(modifiedEvent);
- if (!success) {
- break;
+ if (!injector.injectInputEvent(modifiedEvent)) {
+ throw new ActionException("Failed to inject " + event);
}
}
} else {
throw new ActionException("The given text is not supported: " + text);
}
- return success;
+ return true;
}
@Override