diff options
author | Julien Desprez <jdesprez@google.com> | 2018-05-22 11:18:30 -0700 |
---|---|---|
committer | Julien Desprez <jdesprez@google.com> | 2018-05-22 11:18:30 -0700 |
commit | 191f1730ab3d8f0be1d338cf8fdf30ba2bb14172 (patch) | |
tree | 2705c704bd37150963a664dc6915e3a322f686f8 | |
parent | aa74c540726fa2e263f2559526bc0c851bb185c0 (diff) | |
download | contrib-191f1730ab3d8f0be1d338cf8fdf30ba2bb14172.tar.gz |
Update to proto interface metric
Test: unit tests
Bug: 73163359
Change-Id: I4403b82ca51b42920ca3c3c9792e281574617ca4
-rw-r--r-- | .classpath | 1 | ||||
-rw-r--r-- | src/com/android/example/RebootTest.java | 11 |
2 files changed, 7 insertions, 5 deletions
@@ -4,5 +4,6 @@ <classpathentry kind="src" path="src"/> <classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/> <classpathentry combineaccessrules="false" kind="src" path="/tradefederation"/> + <classpathentry kind="var" path="TRADEFED_ROOT/out/host/common/obj/JAVA_LIBRARIES/host-libprotobuf-java-full_intermediates/classes.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/src/com/android/example/RebootTest.java b/src/com/android/example/RebootTest.java index 8a481d5..c9c5159 100644 --- a/src/com/android/example/RebootTest.java +++ b/src/com/android/example/RebootTest.java @@ -20,13 +20,13 @@ import com.android.tradefed.config.Option; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.IManagedTestDevice; import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.metrics.proto.MetricMeasurement.Metric; import com.android.tradefed.result.ITestInvocationListener; import com.android.tradefed.result.TestDescription; import com.android.tradefed.testtype.IDeviceTest; import com.android.tradefed.testtype.IRemoteTest; -import java.util.Collections; -import java.util.Map; +import java.util.HashMap; /** * Reboots the device and verifies it comes back online. @@ -44,7 +44,7 @@ public class RebootTest implements IRemoteTest, IDeviceTest { @Override public void run(ITestInvocationListener listener) throws DeviceNotAvailableException { long start; - Map<String, String> emptyMap = Collections.emptyMap(); + HashMap<String, Metric> emptyMap = new HashMap<>(); TestDescription testId; start = System.currentTimeMillis(); listener.testRunStarted(String.format("#%d device reboots", mNumDeviceReboots), @@ -56,9 +56,10 @@ public class RebootTest implements IRemoteTest, IDeviceTest { listener.testStarted(testId); try { getDevice().nonBlockingReboot(); - if (((IManagedTestDevice)getDevice()).getMonitor().waitForDeviceOnline() == null) { + if (((IManagedTestDevice) getDevice()).getMonitor().waitForDeviceOnline() + == null) { listener.testFailed(testId, "Reboot failed"); - ((IManagedTestDevice)getDevice()).recoverDevice(); + ((IManagedTestDevice) getDevice()).recoverDevice(); } } finally { |