summaryrefslogtreecommitdiffstats
path: root/tests/tapl/com/android/launcher3
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-09-19 19:26:09 -0700
committerVadim Tryshev <vadimt@google.com>2019-09-21 01:37:56 +0000
commit3bdba615428b384d5130cdaf775c315340c3afbd (patch)
tree2715505c2b0ddbcd2ac40f0aa53afd9c7381f0af /tests/tapl/com/android/launcher3
parent32c8664fb4d853567c638eea3e68ae2e6e66aef3 (diff)
downloadandroid_packages_apps_Trebuchet-3bdba615428b384d5130cdaf775c315340c3afbd.tar.gz
android_packages_apps_Trebuchet-3bdba615428b384d5130cdaf775c315340c3afbd.tar.bz2
android_packages_apps_Trebuchet-3bdba615428b384d5130cdaf775c315340c3afbd.zip
Not using dropbox entries before the test start for diagnostics
Change-Id: Ieb48d969d86a855c91109f4ace0d636fa01aafc7 Merged-in: Ia060b5d2b98ea9ea3b6e61ae11d610f1a888d7a0
Diffstat (limited to 'tests/tapl/com/android/launcher3')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java11
-rw-r--r--tests/tapl/com/android/launcher3/tapl/TestHelpers.java8
2 files changed, 10 insertions, 9 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 15615fc6b..65208ceb5 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -73,7 +73,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
-import java.util.function.Supplier;
+import java.util.function.Function;
/**
* The main tapl object. The only object that can be explicitly constructed by the using code. It
@@ -84,6 +84,7 @@ public final class LauncherInstrumentation {
private static final String TAG = "Tapl";
private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20;
private static final int GESTURE_STEP_MS = 16;
+ private static long START_TIME = System.currentTimeMillis();
// Types for launcher containers that the user is interacting with. "Background" is a
// pseudo-container corresponding to inactive launcher covered by another app.
@@ -134,7 +135,7 @@ public final class LauncherInstrumentation {
private int mExpectedRotation = Surface.ROTATION_0;
private final Uri mTestProviderUri;
private final Deque<String> mDiagnosticContext = new LinkedList<>();
- private Supplier<String> mSystemHealthSupplier;
+ private Function<Long, String> mSystemHealthSupplier;
private Consumer<ContainerType> mOnSettledStateAction;
@@ -296,7 +297,7 @@ public final class LauncherInstrumentation {
return "Background";
}
- public void setSystemHealthSupplier(Supplier<String> supplier) {
+ public void setSystemHealthSupplier(Function<Long, String> supplier) {
this.mSystemHealthSupplier = supplier;
}
@@ -316,8 +317,8 @@ public final class LauncherInstrumentation {
}
return mSystemHealthSupplier != null
- ? mSystemHealthSupplier.get()
- : TestHelpers.getSystemHealthMessage(getContext());
+ ? mSystemHealthSupplier.apply(START_TIME)
+ : TestHelpers.getSystemHealthMessage(getContext(), START_TIME);
}
private void fail(String message) {
diff --git a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
index a089a527e..05c987be2 100644
--- a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
+++ b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
@@ -101,11 +101,11 @@ public class TestHelpers {
return ret.toString();
}
- private static String checkCrash(Context context, String label) {
+ private static String checkCrash(Context context, String label, long startTime) {
DropBoxManager dropbox = (DropBoxManager) context.getSystemService(Context.DROPBOX_SERVICE);
Assert.assertNotNull("Unable access the DropBoxManager service", dropbox);
- long timestamp = System.currentTimeMillis() - 5 * 60000;
+ long timestamp = startTime;
DropBoxManager.Entry entry;
StringBuilder errorDetails = new StringBuilder();
while (null != (entry = dropbox.getNextEntry(label, timestamp))) {
@@ -123,7 +123,7 @@ public class TestHelpers {
return errorDetails.length() != 0 ? errorDetails.toString() : null;
}
- public static String getSystemHealthMessage(Context context) {
+ public static String getSystemHealthMessage(Context context, long startTime) {
try {
StringBuilder errors = new StringBuilder();
@@ -139,7 +139,7 @@ public class TestHelpers {
};
for (String label : labels) {
- final String crash = checkCrash(context, label);
+ final String crash = checkCrash(context, label, startTime);
if (crash != null) errors.append(crash);
}