From e9dcc62d2da65516ec319fd89ba613211930d482 Mon Sep 17 00:00:00 2001 From: Chuwei He Date: Wed, 2 Jul 2025 14:45:26 +0900 Subject: [PATCH] Fix EthernetManagerTest This patch fixes EthernetManagerTest as follows: (1) testEnableDisableInterface_disableEnableEthernet Fix the test error when USB interface is present and treated as ethernet interfaces. (2) testRemoveInterface_disableEnableEthernet Fix the error When tethering interface already presents. Bug: 427055553 Test: atest ConnectivityCoverageTests Flag: EXEMPT mainline Change-Id: I2a31f3f0434b35e9ebe96b4f7003e5a9be0d3e81 --- tests/cts/net/src/android/net/cts/EthernetManagerTest.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt index 110b72e4c8..ae80cc93f0 100644 --- a/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt +++ b/tests/cts/net/src/android/net/cts/EthernetManagerTest.kt @@ -843,6 +843,7 @@ class EthernetManagerTest { @Test fun testEnableDisableInterface_disableEnableEthernet() { + assumeFalse(restoreEthernetRule.isAdbOverEthernet()) val iface = createInterface() val listener = TestInterfaceStateListener() addInterfaceStateListener(listener) @@ -854,7 +855,6 @@ class EthernetManagerTest { listener.eventuallyExpectInterfaceStateChanged(iface.name, STATE_LINK_DOWN, ROLE_CLIENT) enableInterface(iface).expectError() disableInterface(iface).expectError() - listener.assertNoCallback() // When ethernet is enabled, enable/disableInterface() should succeed. restoreEthernetRule.setEthernetEnabled(true) @@ -1006,6 +1006,8 @@ class EthernetManagerTest { @Test fun testRemoveInterface_disableEnableEthernet() { + assumeNoInterfaceForTetheringAvailable() + // Set up 2 interfaces for testing val iface1 = createInterface() val listener = TestInterfaceStateListener()