Use SysuiTestCase#runShellCommand.
This (a) makes the test run rather than fail for trying to get the global instrumentation. (b) May deflake the test (once it is passing) by waiting for shell commands to complete before moving on. Bug: 176891566 Bug: 249756667 Test: com.android.systemui.globalactions.GlobalActionsImeTest Change-Id: I7dbf1b5443a501bb71dafc7bbd89b43b2a09a0b2
This commit is contained in:
@@ -49,6 +49,7 @@ import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@@ -148,8 +149,12 @@ public class GlobalActionsImeTest extends SysuiTestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void executeShellCommand(String cmd) {
|
||||
InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(cmd);
|
||||
private void executeShellCommand(String cmd) {
|
||||
try {
|
||||
runShellCommand(cmd);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user