Make internal printing tests compatible with helpers
WorkflowTest and IPrintManagerParametersTest extend BasePrintTest from
CtsPrintTestCases, which means they now try to load a helper when
BasePrintTest.setUp() runs. Add the helper installer target preparer
and package to their build files so that these can be found as expected.
With UiDevice being removed from BasePrintTest, also move getUiDevice()
over into the internal tests directly so that they can continue using it.
Bug: 153727434
Test: atest PrintSpoolerOutOfProcessTests android.test.IPrintManagerParametersTest
Change-Id: I7ff580c4288c83a69e319ff3668dcb98b11e4f41
diff --git a/packages/PrintSpooler/tests/outofprocess/Android.bp b/packages/PrintSpooler/tests/outofprocess/Android.bp
index c6dc263..0e028b0 100644
--- a/packages/PrintSpooler/tests/outofprocess/Android.bp
+++ b/packages/PrintSpooler/tests/outofprocess/Android.bp
@@ -27,4 +27,5 @@
sdk_version: "test_current",
test_suites: ["device-tests"],
+ required: ["com.android.cts.helpers.aosp"],
}
diff --git a/packages/PrintSpooler/tests/outofprocess/AndroidTest.xml b/packages/PrintSpooler/tests/outofprocess/AndroidTest.xml
index b649e82..922d735 100644
--- a/packages/PrintSpooler/tests/outofprocess/AndroidTest.xml
+++ b/packages/PrintSpooler/tests/outofprocess/AndroidTest.xml
@@ -18,6 +18,8 @@
<option name="test-file-name" value="PrintSpoolerOutOfProcessTests.apk" />
</target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DeviceInteractionHelperInstaller" />
+
<option name="test-suite-tag" value="apct" />
<option name="test-tag" value="PrintSpoolerOutOfProcessTests" />
<option name="config-descriptor:metadata" key="component" value="print" />
diff --git a/packages/PrintSpooler/tests/outofprocess/src/com/android/printspooler/outofprocess/tests/WorkflowTest.java b/packages/PrintSpooler/tests/outofprocess/src/com/android/printspooler/outofprocess/tests/WorkflowTest.java
index 61c2f54..132545b 100644
--- a/packages/PrintSpooler/tests/outofprocess/src/com/android/printspooler/outofprocess/tests/WorkflowTest.java
+++ b/packages/PrintSpooler/tests/outofprocess/src/com/android/printspooler/outofprocess/tests/WorkflowTest.java
@@ -36,6 +36,7 @@
import android.print.test.services.PrinterDiscoverySessionCallbacks;
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
@@ -78,6 +79,10 @@
void accept(T t) throws InterruptedException;
}
+ public static UiDevice getUiDevice() {
+ return UiDevice.getInstance(getInstrumentation());
+ }
+
/**
* Execute {@code waiter} until {@code condition} is met.
*