Add TetherableInterfaceRegexps CTS tests
Test APIs below: getTetherableWifiRegexs() getTetherableUsbRegexs() getTetherableBluetoothRegexs() TetheringInterfaceRegexps.getTetherableWifiRegexs() TetheringInterfaceRegexps.getTetherableUsbRegexs() TetheringInterfaceRegexps.getTetherableBluetoothRegexs() Bug: 152737526 Test: atest CtsTetheringTest Change-Id: Icb7d8718d0aa6574b4c9dd1e17d7feb300fad2aa Merged-In: Icb7d8718d0aa6574b4c9dd1e17d7feb300fad2aa (cherry picked from commit 9f11d903a1d8cc6705481360bae4fb97cfbb966d, aosp/1271822)
This commit is contained in:
@@ -428,4 +428,30 @@ public class TetheringManagerTest {
|
||||
tetherEventCallback.expectTetheredInterfacesChanged(null);
|
||||
mTM.unregisterTetheringEventCallback(tetherEventCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTetherableInterfaceRegexps() {
|
||||
if (!mTM.isTetheringSupported()) return;
|
||||
|
||||
final TestTetheringEventCallback tetherEventCallback = new TestTetheringEventCallback();
|
||||
mTM.registerTetheringEventCallback(c -> c.run(), tetherEventCallback);
|
||||
tetherEventCallback.expectCallbackStarted();
|
||||
|
||||
final TetheringInterfaceRegexps tetherableRegexs =
|
||||
tetherEventCallback.getTetheringInterfaceRegexps();
|
||||
final List<String> wifiRegexs = tetherableRegexs.getTetherableWifiRegexs();
|
||||
final List<String> usbRegexs = tetherableRegexs.getTetherableUsbRegexs();
|
||||
final List<String> btRegexs = tetherableRegexs.getTetherableBluetoothRegexs();
|
||||
|
||||
assertEquals(wifiRegexs, Arrays.asList(mTM.getTetherableWifiRegexs()));
|
||||
assertEquals(usbRegexs, Arrays.asList(mTM.getTetherableUsbRegexs()));
|
||||
assertEquals(btRegexs, Arrays.asList(mTM.getTetherableBluetoothRegexs()));
|
||||
|
||||
//Verify that any of interface name should only contain in one array.
|
||||
wifiRegexs.forEach(s -> assertFalse(usbRegexs.contains(s)));
|
||||
wifiRegexs.forEach(s -> assertFalse(btRegexs.contains(s)));
|
||||
usbRegexs.forEach(s -> assertFalse(btRegexs.contains(s)));
|
||||
|
||||
mTM.unregisterTetheringEventCallback(tetherEventCallback);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user