diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-06-18 18:36:37 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-06-18 18:36:37 -0700 |
commit | d7ed9175aa269db8977ef05b095cfc2fabcc9c7a (patch) | |
tree | 4651f685661824951ede16d642e3f020c8f9eda7 /core/java/android/test | |
parent | e748161ca89867e8c57d4e71c780486d4de8039c (diff) | |
download | frameworks_base-d7ed9175aa269db8977ef05b095cfc2fabcc9c7a.zip frameworks_base-d7ed9175aa269db8977ef05b095cfc2fabcc9c7a.tar.gz frameworks_base-d7ed9175aa269db8977ef05b095cfc2fabcc9c7a.tar.bz2 |
Fix bug 1927213 test failures.
Eat the security exception that is now thrown by the window manager to
retain the old behavior for tests. (We still need to throw the
exception from the WM for the new permission tests.)
Diffstat (limited to 'core/java/android/test')
-rw-r--r-- | core/java/android/test/InstrumentationTestCase.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/core/java/android/test/InstrumentationTestCase.java b/core/java/android/test/InstrumentationTestCase.java index 470ab0d..2145d7c 100644 --- a/core/java/android/test/InstrumentationTestCase.java +++ b/core/java/android/test/InstrumentationTestCase.java @@ -241,7 +241,13 @@ public class InstrumentationTestCase extends TestCase { try { final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key); 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) { Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key); break; @@ -266,7 +272,13 @@ public class InstrumentationTestCase extends TestCase { final Instrumentation instrumentation = getInstrumentation(); 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(); @@ -292,7 +304,13 @@ public class InstrumentationTestCase extends TestCase { final int keyCount = keys[i]; final int keyCode = keys[i + 1]; 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. + } } } |