summaryrefslogtreecommitdiff
path: root/tests/cts/src/android/healthconnect/cts/TestUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cts/src/android/healthconnect/cts/TestUtils.java')
-rw-r--r--tests/cts/src/android/healthconnect/cts/TestUtils.java43
1 files changed, 22 insertions, 21 deletions
diff --git a/tests/cts/src/android/healthconnect/cts/TestUtils.java b/tests/cts/src/android/healthconnect/cts/TestUtils.java
index 8f3ec4c8..c40e8885 100644
--- a/tests/cts/src/android/healthconnect/cts/TestUtils.java
+++ b/tests/cts/src/android/healthconnect/cts/TestUtils.java
@@ -145,6 +145,7 @@ public class TestUtils {
public static final Instant SESSION_END_TIME =
Instant.now().minus(10, ChronoUnit.DAYS).plus(1, ChronoUnit.HOURS);
private static final String TAG = "HCTestUtils";
+ private static final int TIMEOUT_SECONDS = 5;
public static boolean isHardwareAutomotive() {
return hasSystemFeature(AUTOMOTIVE_FEATURE);
@@ -175,7 +176,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -215,7 +216,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -245,7 +246,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -277,7 +278,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -467,7 +468,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -505,7 +506,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -540,7 +541,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -575,7 +576,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -629,7 +630,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (healthConnectExceptionAtomicReference.get() != null) {
throw healthConnectExceptionAtomicReference.get();
}
@@ -661,7 +662,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -696,7 +697,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -728,7 +729,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -759,7 +760,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -804,7 +805,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -844,7 +845,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
assertThat(responseException.get()).isNull();
assertThat(response).isNotNull();
} finally {
@@ -882,7 +883,7 @@ public class TestUtils {
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}
@@ -938,7 +939,7 @@ public class TestUtils {
Log.e(TAG, exception.getMessage());
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
}
public static void finishMigration() throws InterruptedException {
@@ -961,7 +962,7 @@ public class TestUtils {
Log.e(TAG, exception.getMessage());
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
}
public static void insertMinDataMigrationSdkExtensionVersion(int version)
@@ -989,7 +990,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isTrue();
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isTrue();
if (migrationExceptionAtomicReference.get() != null) {
throw migrationExceptionAtomicReference.get();
}
@@ -1029,7 +1030,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (responseException.get() != null) {
throw responseException.get();
}
@@ -1059,7 +1060,7 @@ public class TestUtils {
latch.countDown();
}
});
- assertThat(latch.await(3, TimeUnit.SECONDS)).isEqualTo(true);
+ assertThat(latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)).isEqualTo(true);
if (exceptionAtomicReference.get() != null) {
throw exceptionAtomicReference.get();
}