diff options
Diffstat (limited to 'tests')
4 files changed, 44 insertions, 300 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java index 2e6886493..36bf52b6b 100644 --- a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java @@ -328,7 +328,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener staAvailListener // availableListener @@ -342,7 +341,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -403,7 +401,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -554,7 +551,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -601,7 +597,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -627,7 +622,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, "wlan0", TestChipV1.AP_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -644,7 +638,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV1.STA_CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -682,7 +675,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, "wlan0", TestChipV2.CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -702,7 +694,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, "wlan0", TestChipV2.CHIP_MODE_ID, - false, // high priority null, // tearDownList null, // destroyedListener null // availableListener @@ -907,7 +898,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate name, // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -968,7 +958,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { any(IWifiIface.getTypeCallback.class)); doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, staIface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - assertEquals(staIface, mDut.createStaIface(false, staIdl, null)); + assertEquals(staIface, mDut.createStaIface(staIdl, null)); mInOrder.verify(chipMock.chip).configureChip(TestChipV1.STA_CHIP_MODE_ID); mInOrder.verify(staIafrl).onAvailabilityChanged(false); @@ -1025,7 +1015,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate name, // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -1123,7 +1112,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener @@ -1133,7 +1121,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // register additional InterfaceDestroyedListeners - including a duplicate (verify that @@ -1148,7 +1136,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener @@ -1165,7 +1152,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) new IWifiIface[]{staIface, p2pIface}, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener @@ -1197,7 +1183,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null, // availableListener @@ -1222,7 +1207,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener2, // destroyedListener null // availableListener @@ -1253,7 +1237,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -1312,7 +1295,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener1, // destroyedListener staAvailListener1 // availableListener @@ -1322,7 +1304,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(staAvailListener1).onAvailabilityChanged(false); // get STA interface again - IWifiIface staIface2 = mDut.createStaIface(false, staDestroyedListener2, mHandler); + IWifiIface staIface2 = mDut.createStaIface(staDestroyedListener2, mHandler); collector.checkThat("STA created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener1, @@ -1455,7 +1437,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1469,7 +1450,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1490,7 +1470,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1501,7 +1480,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1525,7 +1504,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener2, // destroyedListener null // availableListener (already registered) @@ -1535,7 +1513,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(false, null, null); + IWifiIface staIface3 = mDut.createStaIface(null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create AP - this will destroy the last STA created, i.e. STA2 @@ -1545,7 +1523,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered), @@ -1573,7 +1550,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV2.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1732,7 +1708,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1746,7 +1721,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -1768,7 +1742,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -1780,7 +1753,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -1810,7 +1783,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener2, // destroyedListener null // availableListener (already registered) @@ -1820,7 +1792,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(staAvailListener).onAvailabilityChanged(false); // request STA3: should fail - IWifiIface staIface3 = mDut.createStaIface(false, null, null); + IWifiIface staIface3 = mDut.createStaIface(null, null); collector.checkThat("STA3 should not be created", staIface3, IsNull.nullValue()); // create NAN: should destroy the last created STA (STA2) @@ -1830,7 +1802,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV3.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -1844,7 +1815,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(staDestroyedListener2).onDestroyed(getName(staIface2)); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, @@ -1996,7 +1967,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2011,7 +1981,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList p2pDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2032,7 +2001,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.AP, // ifaceTypeToCreate "wlan1", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList apDestroyedListener, // destroyedListener null, // availableListener (already registered) @@ -2044,7 +2012,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(apAvailListener).onAvailabilityChanged(false); // request STA2: should fail - IWifiIface staIface2 = mDut.createStaIface(false, null, null); + IWifiIface staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // request AP2: should fail @@ -2066,7 +2034,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { verify(apDestroyedListener).onDestroyed(getName(apIface)); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // create NAN @@ -2076,7 +2044,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener null // availableListener (already registered) @@ -2086,7 +2053,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { inOrderAvail.verify(nanAvailListener).onAvailabilityChanged(false); // request STA2: should fail - staIface2 = mDut.createStaIface(false, null, null); + staIface2 = mDut.createStaIface(null, null); collector.checkThat("STA2 should not be created", staIface2, IsNull.nullValue()); // tear down STA @@ -2171,222 +2138,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { assertEquals(correctResults, results); } - /////////////////////////////////////////////////////////////////////////////////////// - // Tests targeting low priority STA creation - /////////////////////////////////////////////////////////////////////////////////////// - - /** - * Validate low priority STA management on Test Chip V1 (which has single STA capability). - * Procedure: - * - Create STA - * - Create STA(low priority): expect failure - * - Create AP: expect STA to be deleted - * - Create STA(low priority): expect failure - * - Delete AP - * - Create STA(low priority): success! - * - Create STA: expect STA(low priority) to be deleted - */ - @Test - public void testLowPriorityStaTestChipV1() throws Exception { - TestChipV1 chipMock = new TestChipV1(); - chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); - executeAndValidateInitializationSequence(); - executeAndValidateStartupSequence(); - - InterfaceDestroyedListener staDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener staLpDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener apDestroyedListener = mock( - InterfaceDestroyedListener.class); - - // create STA - IWifiIface staIface = validateInterfaceSequence(chipMock, - false, // chipModeValid - -1000, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA interface wasn't created", staIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - IWifiIface staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // create AP: will destroy STA - IWifiIface apIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.STA_CHIP_MODE_ID, // chipModeId - IfaceType.AP, // ifaceTypeToCreate - "ap0", // ifaceName - TestChipV1.AP_CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) - null, // tearDownList - apDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan0", staDestroyedListener) - ); - collector.checkThat("AP interface wasn't created", apIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // tear down AP - mDut.removeIface(apIface); - mTestLooper.dispatchAll(); - verify(chipMock.chip).removeApIface("ap0"); - verify(apDestroyedListener).onDestroyed(getName(apIface)); - - // create STA(low priority) - staLowIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.AP_CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan1", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - true, // low priority - null, // tearDownList - staLpDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA(low priority) interface wasn't created", staIface, - IsNull.notNullValue()); - - // create STA: should destroy the low priority STA - staIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV1.STA_CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV1.STA_CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan1", staLpDestroyedListener) - ); - collector.checkThat("STA interface wasn't created", staIface, - IsNull.notNullValue()); - - verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, - apDestroyedListener, staLpDestroyedListener); - } - - /** - * Validate low priority STA management on Test Chip V4 (which has single STA+AP capability). - * Procedure: - * - Create STA - * - Create STA(low priority): expect failure - * - Create AP - * - Create STA: expect failure - * - Destroy STA - * - Create STA(low priority): success! - * - Create STA: expect STA(low priority) to be deleted - */ - @Test - public void testLowPriorityStaTestChipV4() throws Exception { - TestChipV4 chipMock = new TestChipV4(); - chipMock.initialize(); - mInOrder = inOrder(mServiceManagerMock, mWifiMock, chipMock.chip, - mManagerStatusListenerMock); - executeAndValidateInitializationSequence(); - executeAndValidateStartupSequence(); - - InterfaceDestroyedListener staDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener staLpDestroyedListener = mock( - InterfaceDestroyedListener.class); - InterfaceDestroyedListener apDestroyedListener = mock( - InterfaceDestroyedListener.class); - - // create STA - IWifiIface staIface = validateInterfaceSequence(chipMock, - false, // chipModeValid - -1000, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA interface wasn't created", staIface, IsNull.notNullValue()); - - // request STA(low priority): should fail - IWifiIface staLowIface = mDut.createStaIface(true, null, null); - collector.checkThat("STA(low priority) should not be created", staLowIface, - IsNull.nullValue()); - - // create AP - IWifiIface apIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId - IfaceType.AP, // ifaceTypeToCreate - "ap0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority (but irrelevant) - null, // tearDownList - apDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("AP interface wasn't created", apIface, IsNull.notNullValue()); - - // request STA2: should fail - IWifiIface sta2Iface = mDut.createStaIface(true, null, null); - collector.checkThat("STA2 should not be created", sta2Iface, - IsNull.nullValue()); - - // tear down STA - mDut.removeIface(staIface); - mTestLooper.dispatchAll(); - verify(chipMock.chip).removeStaIface("wlan0"); - verify(staDestroyedListener).onDestroyed(getName(staIface)); - - // create STA(low priority) - staLowIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan1", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - true, // low priority - null, // tearDownList - staLpDestroyedListener, // destroyedListener - null // availableListener (already registered) - ); - collector.checkThat("STA(low priority) interface wasn't created", staIface, - IsNull.notNullValue()); - - // create STA: should destroy the low priority STA - staIface = validateInterfaceSequence(chipMock, - true, // chipModeValid - TestChipV4.CHIP_MODE_ID, // chipModeId (only used if chipModeValid is true) - IfaceType.STA, // ifaceTypeToCreate - "wlan0", // ifaceName - TestChipV4.CHIP_MODE_ID, // finalChipMode - false, // high priority - null, // tearDownList - staDestroyedListener, // destroyedListener - null, // availableListener (already registered) - new InterfaceDestroyedListenerWithIfaceName("wlan1", staLpDestroyedListener) - ); - collector.checkThat("STA interface wasn't created", staIface, - IsNull.notNullValue()); - - verifyNoMoreInteractions(mManagerStatusListenerMock, staDestroyedListener, - apDestroyedListener, staLpDestroyedListener); - } /////////////////////////////////////////////////////////////////////////////////////// // utilities @@ -2472,7 +2223,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { ifaceTypeToCreate, ifaceName, finalChipMode, - false, // high priority null, // tearDownList idl, // destroyedListener iafrl // availableListener @@ -2553,7 +2303,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.STA, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority null, // tearDownList staDestroyedListener, // destroyedListener staAvailListener // availableListener @@ -2568,7 +2317,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -2585,7 +2333,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.P2P, // ifaceTypeToCreate "p2p0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) new IWifiIface[]{nanIface}, // tearDownList p2pDestroyedListener, // destroyedListener null, // availableListener @@ -2619,7 +2366,6 @@ public class HalDeviceManagerTest extends WifiBaseTest { IfaceType.NAN, // ifaceTypeToCreate "wlan0", // ifaceName onlyChipMode, // finalChipMode - false, // high priority (but irrelevant) null, // tearDownList nanDestroyedListener, // destroyedListener nanAvailListener // availableListener @@ -2635,7 +2381,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { private IWifiIface validateInterfaceSequence(ChipMockBase chipMock, boolean chipModeValid, int chipModeId, - int ifaceTypeToCreate, String ifaceName, int finalChipMode, boolean lowPriority, + int ifaceTypeToCreate, String ifaceName, int finalChipMode, IWifiIface[] tearDownList, InterfaceDestroyedListener destroyedListener, HalDeviceManager.InterfaceAvailableForRequestListener availableListener, @@ -2659,7 +2405,7 @@ public class HalDeviceManagerTest extends WifiBaseTest { doAnswer(new CreateXxxIfaceAnswer(chipMock, mStatusOk, iface)).when( chipMock.chip).createStaIface(any(IWifiChip.createStaIfaceCallback.class)); - mDut.createStaIface(lowPriority, destroyedListener, mHandler); + mDut.createStaIface(destroyedListener, mHandler); break; case IfaceType.AP: iface = mock(IWifiApIface.class); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java index e2a233784..7d76eacee 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; @@ -120,7 +119,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mWifiVendorHalRadioModeChangeHandlerCaptor.capture()); when(mWifiVendorHal.isVendorHalSupported()).thenReturn(true); when(mWifiVendorHal.startVendorHal()).thenReturn(true); - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(IFACE_NAME_0); + when(mWifiVendorHal.createStaIface(any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.createApIface(any())).thenReturn(IFACE_NAME_0); when(mWifiVendorHal.removeStaIface(any())).thenReturn(true); when(mWifiVendorHal.removeApIface(any())).thenReturn(true); @@ -466,12 +465,11 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { // Trigger the AP interface teardown when STA interface is created. // The iface name will remain the same. doAnswer(new MockAnswerUtil.AnswerWithArguments() { - public String answer(boolean lowPrioritySta, - InterfaceDestroyedListener destroyedListener) { + public String answer(InterfaceDestroyedListener destroyedListener) { mIfaceDestroyedListenerCaptor0.getValue().onDestroyed(IFACE_NAME_0); return IFACE_NAME_0; } - }).when(mWifiVendorHal).createStaIface(anyBoolean(), any()); + }).when(mWifiVendorHal).createStaIface(any()); assertEquals(IFACE_NAME_0, mWifiNative.setupInterfaceForClientInConnectivityMode(mIfaceCallback1)); @@ -482,7 +480,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor1.capture()); // Creation of STA interface should trigger the AP interface destroy. validateOnDestroyedSoftApInterface( @@ -848,7 +846,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { */ @Test public void testSetupClientInterfaceFailureInHalCreateStaIface() throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(null); + when(mWifiVendorHal.createStaIface(any())).thenReturn(null); assertNull(mWifiNative.setupInterfaceForClientInConnectivityMode(mIfaceCallback0)); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); @@ -859,7 +857,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), any()); + mInOrder.verify(mWifiVendorHal).createStaIface(any()); mInOrder.verify(mWifiMetrics).incrementNumSetupClientInterfaceFailureDueToHal(); // To test if the failure is handled cleanly, invoke teardown and ensure that @@ -886,7 +884,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any(), any(), any(), any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); @@ -920,7 +918,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete(); mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( mIfaceDestroyedListenerCaptor0.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(any(), any(), any(), any()); mInOrder.verify(mSupplicantStaIfaceHal).setupIface(any()); @@ -1332,7 +1330,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<NetdEventObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(ifaceName); + when(mWifiVendorHal.createStaIface(any())).thenReturn(ifaceName); assertEquals(ifaceName, mWifiNative.setupInterfaceForClientInConnectivityMode(callback)); validateSetupClientInterface( @@ -1356,7 +1354,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any()); } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( destroyedListenerCaptor.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(eq(ifaceName), any(), any(), any()); @@ -1417,7 +1415,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { String ifaceName, @Mock WifiNative.InterfaceCallback callback, ArgumentCaptor<InterfaceDestroyedListener> destroyedListenerCaptor, ArgumentCaptor<NetdEventObserver> networkObserverCaptor) throws Exception { - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(ifaceName); + when(mWifiVendorHal.createStaIface(any())).thenReturn(ifaceName); assertEquals(ifaceName, mWifiNative.setupInterfaceForClientInScanMode(callback)); validateSetupClientInterfaceForScan( @@ -1434,7 +1432,7 @@ public class WifiNativeInterfaceManagementTest extends WifiBaseTest { mInOrder.verify(mWifiVendorHal).startVendorHal(); } mInOrder.verify(mWifiVendorHal).isVendorHalSupported(); - mInOrder.verify(mWifiVendorHal).createStaIface(eq(false), + mInOrder.verify(mWifiVendorHal).createStaIface( destroyedListenerCaptor.capture()); mInOrder.verify(mWificondControl).setupInterfaceForClientMode(eq(ifaceName), any(), any(), any()); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java index f82c13f6e..07532fd95 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java @@ -248,7 +248,7 @@ public class WifiNativeTest extends WifiBaseTest { when(mWifiVendorHal.startVendorHal()).thenReturn(true); when(mWifiVendorHal.startVendorHalSta()).thenReturn(true); when(mWifiVendorHal.startVendorHalAp()).thenReturn(true); - when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(WIFI_IFACE_NAME); + when(mWifiVendorHal.createStaIface(any())).thenReturn(WIFI_IFACE_NAME); when(mWificondControl.setupInterfaceForClientMode(any(), any(), any(), any())).thenReturn( true); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java index 8778c5581..2cdcf2dda 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java @@ -380,7 +380,7 @@ public class WifiVendorHalTest extends WifiBaseTest { mLooper.dispatchAll(); } }).when(mHalDeviceManager).stop(); - when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))) + when(mHalDeviceManager.createStaIface(any(), eq(null))) .thenReturn(mIWifiStaIface); when(mHalDeviceManager.createApIface(any(), eq(null))) .thenReturn(mIWifiApIface); @@ -456,7 +456,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); @@ -481,7 +481,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).isReady(); verify(mHalDeviceManager).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); } /** @@ -502,7 +502,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); verify(mIWifiStaIface, never()) @@ -515,12 +515,12 @@ public class WifiVendorHalTest extends WifiBaseTest { */ @Test public void testStartHalFailureInIfaceCreationInStaMode() throws Exception { - when(mHalDeviceManager.createStaIface(anyBoolean(), any(), eq(null))).thenReturn(null); + when(mHalDeviceManager.createStaIface(any(), eq(null))).thenReturn(null); assertFalse(mWifiVendorHal.startVendorHalSta()); assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mHalDeviceManager, never()).createApIface(any(), eq(null)); @@ -540,7 +540,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -560,7 +560,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -580,7 +580,7 @@ public class WifiVendorHalTest extends WifiBaseTest { assertFalse(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(any(IWifiIface.class)); verify(mHalDeviceManager).stop(); verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class)); @@ -603,7 +603,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).createApIface(any(), eq(null)); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class)); } @@ -621,7 +621,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager).start(); verify(mHalDeviceManager).stop(); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); @@ -648,7 +648,7 @@ public class WifiVendorHalTest extends WifiBaseTest { verify(mHalDeviceManager, times(2)).isReady(); verify(mHalDeviceManager, times(2)).isStarted(); - verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null)); + verify(mHalDeviceManager, never()).createStaIface(any(), eq(null)); } /** @@ -661,11 +661,11 @@ public class WifiVendorHalTest extends WifiBaseTest { InterfaceDestroyedListener externalLister = mock(InterfaceDestroyedListener.class); assertTrue(mWifiVendorHal.startVendorHal()); - assertNotNull(mWifiVendorHal.createStaIface(false, externalLister)); + assertNotNull(mWifiVendorHal.createStaIface(externalLister)); assertTrue(mWifiVendorHal.isHalStarted()); verify(mHalDeviceManager).start(); - verify(mHalDeviceManager).createStaIface(eq(false), internalListenerCaptor.capture(), + verify(mHalDeviceManager).createStaIface(internalListenerCaptor.capture(), eq(null)); verify(mHalDeviceManager).getChip(eq(mIWifiStaIface)); verify(mHalDeviceManager).isReady(); @@ -2831,8 +2831,8 @@ public class WifiVendorHalTest extends WifiBaseTest { }).when(mIWifiStaIface).getName(any(IWifiIface.getNameCallback.class)); assertTrue(mWifiVendorHal.startVendorHal()); - assertNull(mWifiVendorHal.createStaIface(true, null)); - verify(mHalDeviceManager).createStaIface(eq(true), any(), eq(null)); + assertNull(mWifiVendorHal.createStaIface(null)); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); } /** @@ -2858,8 +2858,8 @@ public class WifiVendorHalTest extends WifiBaseTest { @Test public void testCreateRemoveStaIface() throws RemoteException { assertTrue(mWifiVendorHal.startVendorHal()); - String ifaceName = mWifiVendorHal.createStaIface(false, null); - verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null)); + String ifaceName = mWifiVendorHal.createStaIface(null); + verify(mHalDeviceManager).createStaIface(any(), eq(null)); assertEquals(TEST_IFACE_NAME, ifaceName); assertTrue(mWifiVendorHal.removeStaIface(ifaceName)); verify(mHalDeviceManager).removeIface(eq(mIWifiStaIface)); |