Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7ed9175 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

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.)
parent e748161c
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -241,7 +241,13 @@ public class InstrumentationTestCase extends TestCase {
                try {
                    final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key);
                    final int keyCode = keyCodeField.getInt(null);
                    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++) {
            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++) {
                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.
                }
            }
        }