ethernet: use short timeout for assumeNoInterfaceForTetheringAvailable
assumeNoInterfaceForTetheringAvailable checks if an interface is
available for tethering and throws and assumption failure accordingly.
If a physical interface is present, onAvailable() will be called almost
immediately, so there is no need to ever wait for TIMEOUT_MS. This is
especially important now that TIMEOUT_MS is being increased to 10s.
Test: atest EthernetManagerTest
Change-Id: I2f58d7690dbe4c25cfb01a8b29717cea6a01ab32
diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
index 122eb15..e56602c 100644
--- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
@@ -303,8 +303,8 @@
available.completeExceptionally(IllegalStateException("onUnavailable was called"))
}
- fun expectOnAvailable(): String {
- return available.get(TIMEOUT_MS, TimeUnit.MILLISECONDS)
+ fun expectOnAvailable(timeout: Long = TIMEOUT_MS): String {
+ return available.get(timeout, TimeUnit.MILLISECONDS)
}
fun expectOnUnavailable() {
@@ -623,7 +623,7 @@
// see aosp/2123900.
try {
// assumeException does not exist.
- requestTetheredInterface().expectOnAvailable()
+ requestTetheredInterface().expectOnAvailable(NO_CALLBACK_TIMEOUT_MS)
// interface used for tethering is available, throw an assumption error.
assumeTrue(false)
} catch (e: TimeoutException) {