Merge change 4702 into donut
* changes: Fix bug 1927213 test failures.
This commit is contained in:
@@ -241,7 +241,13 @@ public class InstrumentationTestCase extends TestCase {
|
|||||||
try {
|
try {
|
||||||
final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key);
|
final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key);
|
||||||
final int keyCode = keyCodeField.getInt(null);
|
final int keyCode = keyCodeField.getInt(null);
|
||||||
instrumentation.sendKeyDownUpSync(keyCode);
|
try {
|
||||||
|
instrumentation.sendKeyDownUpSync(keyCode);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// Ignore security exceptions that are now thrown
|
||||||
|
// when trying to send to another app, to retain
|
||||||
|
// compatibility with existing tests.
|
||||||
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
|
Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
|
||||||
break;
|
break;
|
||||||
@@ -266,7 +272,13 @@ public class InstrumentationTestCase extends TestCase {
|
|||||||
final Instrumentation instrumentation = getInstrumentation();
|
final Instrumentation instrumentation = getInstrumentation();
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
instrumentation.sendKeyDownUpSync(keys[i]);
|
try {
|
||||||
|
instrumentation.sendKeyDownUpSync(keys[i]);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// Ignore security exceptions that are now thrown
|
||||||
|
// when trying to send to another app, to retain
|
||||||
|
// compatibility with existing tests.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -292,7 +304,13 @@ public class InstrumentationTestCase extends TestCase {
|
|||||||
final int keyCount = keys[i];
|
final int keyCount = keys[i];
|
||||||
final int keyCode = keys[i + 1];
|
final int keyCode = keys[i + 1];
|
||||||
for (int j = 0; j < keyCount; j++) {
|
for (int j = 0; j < keyCount; j++) {
|
||||||
instrumentation.sendKeyDownUpSync(keyCode);
|
try {
|
||||||
|
instrumentation.sendKeyDownUpSync(keyCode);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// Ignore security exceptions that are now thrown
|
||||||
|
// when trying to send to another app, to retain
|
||||||
|
// compatibility with existing tests.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user