summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-10-24 21:51:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-10-24 21:51:09 +0000
commit87a29e9ac2f5373862e87a2db065d595bf355cc4 (patch)
treed27a146937c12e45682bf88672953e989a0b1207
parente961e2251977b2e1a8b2bc49886c8266b3f27bbf (diff)
parent44676b762f885dd896e9f4dc056ab05dad6173d7 (diff)
downloadPermission-87a29e9ac2f5373862e87a2db065d595bf355cc4.tar.gz
Merge changes from topic "cherrypicker-L61600000963649159:N20600001415965012" into android14-tests-dev
* changes: Allow timeout to be even larger than 1 minute. Bump timeout when ran in post-submit.
-rw-r--r--tests/utils/safetycenter/java/com/android/safetycenter/testing/Coroutines.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/utils/safetycenter/java/com/android/safetycenter/testing/Coroutines.kt b/tests/utils/safetycenter/java/com/android/safetycenter/testing/Coroutines.kt
index 44c0686e2..6c6336da3 100644
--- a/tests/utils/safetycenter/java/com/android/safetycenter/testing/Coroutines.kt
+++ b/tests/utils/safetycenter/java/com/android/safetycenter/testing/Coroutines.kt
@@ -17,6 +17,7 @@
package com.android.safetycenter.testing
import android.util.Log
+import androidx.test.platform.app.InstrumentationRegistry
import java.time.Duration
import kotlinx.coroutines.DEBUG_PROPERTY_NAME
import kotlinx.coroutines.DEBUG_PROPERTY_VALUE_AUTO
@@ -29,8 +30,15 @@ import kotlinx.coroutines.withTimeoutOrNull
/** A class that facilitates interacting with coroutines. */
object Coroutines {
+ private val TEST_TIMEOUT: Duration
+ get() =
+ Duration.ofMillis(
+ InstrumentationRegistry.getArguments().getString("timeout_msec", "60000").toLong()
+ )
+
/** A long timeout, to be used for actions that are expected to complete. */
- val TIMEOUT_LONG: Duration = Duration.ofSeconds(25)
+ val TIMEOUT_LONG: Duration
+ get() = TEST_TIMEOUT.dividedBy(2)
/** A short timeout, to be used for actions that are expected not to complete. */
val TIMEOUT_SHORT: Duration = Duration.ofSeconds(1)