summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-06-27 19:16:38 -0700
committervadimt <vadimt@google.com>2019-07-15 12:29:13 -0700
commit092b6f8cbf40b0f144fb4d903f92ade6bdbacb0e (patch)
treef5393616b3328fcbb13314a4bf7de2a21f6b7584 /tests/src
parenteb078ba5dd0e0256990a2075f9ead920e0e3750f (diff)
downloadandroid_packages_apps_Trebuchet-092b6f8cbf40b0f144fb4d903f92ade6bdbacb0e.tar.gz
android_packages_apps_Trebuchet-092b6f8cbf40b0f144fb4d903f92ade6bdbacb0e.tar.bz2
android_packages_apps_Trebuchet-092b6f8cbf40b0f144fb4d903f92ade6bdbacb0e.zip
Adding system health diags for inporoc tests
Bug: 133891845 Change-Id: I90161bfc9db5983a45dfb89728a82ec1e3d81f19
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java17
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java7
2 files changed, 19 insertions, 5 deletions
diff --git a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
index fa23b8d5b..6a6916eec 100644
--- a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
+++ b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
@@ -32,13 +32,14 @@ import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.util.Base64;
+import androidx.test.InstrumentationRegistry;
+
+import com.android.launcher3.tapl.TestHelpers;
+
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
-import androidx.test.InstrumentationRegistry;
-
/**
* Content provider to receive commands from tests
*/
@@ -47,6 +48,7 @@ public class TestCommandReceiver extends ContentProvider {
public static final String ENABLE_TEST_LAUNCHER = "enable-test-launcher";
public static final String DISABLE_TEST_LAUNCHER = "disable-test-launcher";
public static final String KILL_PROCESS = "kill-process";
+ public static final String GET_SYSTEM_HEALTH_MESSAGE = "get-system-health-message";
@Override
public boolean onCreate() {
@@ -99,6 +101,12 @@ public class TestCommandReceiver extends ContentProvider {
killBackgroundProcesses(arg);
return null;
}
+
+ case GET_SYSTEM_HEALTH_MESSAGE: {
+ final Bundle response = new Bundle();
+ response.putString("result", TestHelpers.getSystemHealthMessage(getContext()));
+ return response;
+ }
}
return super.call(method, arg, extras);
}
@@ -122,7 +130,8 @@ public class TestCommandReceiver extends ContentProvider {
// Create an empty file so that we can pass its descriptor
try {
file.createNewFile();
- } catch (IOException e) { }
+ } catch (IOException e) {
+ }
}
return ParcelFileDescriptor.open(file, MODE_READ_WRITE);
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index e39fc76a0..361f2fb53 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -51,6 +51,7 @@ import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.TestHelpers;
+import com.android.launcher3.testcomponent.TestCommandReceiver;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.FailureWatcher;
@@ -98,7 +99,11 @@ public abstract class AbstractLauncherUiTest {
} catch (RemoteException e) {
throw new RuntimeException(e);
}
- if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests();
+ if (TestHelpers.isInLauncherProcess()) {
+ Utilities.enableRunningInTestHarnessForTests();
+ mLauncher.setSystemHealthSupplier(() -> TestCommandReceiver.callCommand(
+ TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE).getString("result"));
+ }
}
protected final LauncherActivityRule mActivityMonitor = new LauncherActivityRule();