ethernet: test adding listener after removing server mode iface

Tests that registering a EthernetStateListener functions as expected
after requesting a tethering interface and subsequently removing that
interface.

Test: atest testCallbacks_afterRemovingServerModeInterface
Bug: 290971780
Change-Id: I7b6e1a3b3ac23f4fbdd2d20f63f83d59c4d4999d
This commit is contained in:
Patrick Rohr 2023-07-21 15:39:32 -07:00
commit f848c6c689

View file

@ -667,6 +667,20 @@ class EthernetManagerTest {
listener.expectCallback(iface, STATE_LINK_UP, ROLE_CLIENT)
}
@Test
fun testCallbacks_afterRemovingServerModeInterface() {
// do not run this test if an interface that can be used for tethering already exists.
assumeNoInterfaceForTetheringAvailable()
val iface = createInterface()
requestTetheredInterface().expectOnAvailable()
removeInterface(iface)
val listener = EthernetStateListener()
addInterfaceStateListener(listener)
listener.assertNoCallback()
}
@Test
fun testGetInterfaceList() {
// Create two test interfaces and check the return list contains the interface names.