ethernet: enable testCallbacks_forServerModeInterfaces on CF
testCallbacks_forServerModeInterfaces was previously skipped on CF as
isAdbOverNetwork() was true. The existing interface on CF has configured
NetworkCapabilities which excludes it from being used in tethering.
Using assumeNoInterfaceForTetheringAvailable() is therefore a better
assumption check for this test.
Test: atest EthernetManagerTest
Bug: 252963267
Change-Id: If6cefa519b32d041c8dccc0a58acb3028eefd878
(cherry picked from commit 525c30205c2c5563a80a645eb529396e5a95c163)
Merged-In: If6cefa519b32d041c8dccc0a58acb3028eefd878
diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
index 8b87421..975654b 100644
--- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
+++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt
@@ -49,7 +49,6 @@
import android.os.Handler
import android.os.HandlerExecutor
import android.os.Looper
-import android.os.SystemProperties
import android.platform.test.annotations.AppModeFull
import android.util.ArraySet
import androidx.test.platform.app.InstrumentationRegistry
@@ -66,7 +65,6 @@
import com.android.testutils.runAsShell
import com.android.testutils.waitForIdle
import org.junit.After
-import org.junit.Assume.assumeFalse
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.Test
@@ -415,19 +413,10 @@
}
}
- // TODO: this function is now used in two places (EthernetManagerTest and
- // EthernetTetheringTest), so it should be moved to testutils.
- private fun isAdbOverNetwork(): Boolean {
- // If adb TCP port opened, this test may running by adb over network.
- return (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1 ||
- SystemProperties.getInt("service.adb.tcp.port", -1) > -1)
- }
-
@Test
fun testCallbacks_forServerModeInterfaces() {
- // do not run this test when adb might be connected over ethernet.
- // TODO: Consider using assumeNoInterfaceForTetheringAvailable() instead, so this runs on CF
- assumeFalse(isAdbOverNetwork())
+ // do not run this test if an interface that can be used for tethering already exists.
+ assumeNoInterfaceForTetheringAvailable()
val iface = createInterface()
requestTetheredInterface().expectOnAvailable()