diff options
author | Roshan Pius <rpius@google.com> | 2020-04-09 02:26:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-09 02:26:53 +0000 |
commit | ad8cab35e0fb19d3b667b2cd700c77615b83cb7f (patch) | |
tree | a1e488f34db6e03aa4265fb30907c300b0cda6db /tests | |
parent | 5f0f9ba388db8b39d659d6294141778a940c6267 (diff) | |
parent | 168ede29fc294eb4063f0cc2e54b4e9f9394dc01 (diff) |
Merge "WifiNetworkFactory: Ensure we disconnect when we release request" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java index 684fd1449..b495b49c7 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java @@ -1579,6 +1579,36 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { } /** + * Verify handling of request release after starting connection to the network. + */ + @Test + public void testHandleNetworkReleaseWithSpecifierAfterConnectionStart() throws Exception { + sendNetworkRequestAndSetupForConnectionStatus(); + + assertNotNull(mSelectedNetwork); + + // Now release the network request. + WifiConfiguration wcmNetwork = new WifiConfiguration(mSelectedNetwork); + wcmNetwork.networkId = TEST_NETWORK_ID_1; + wcmNetwork.creatorUid = TEST_UID_1; + wcmNetwork.creatorName = TEST_PACKAGE_NAME_1; + wcmNetwork.shared = false; + wcmNetwork.fromWifiNetworkSpecifier = true; + wcmNetwork.ephemeral = true; + when(mWifiConfigManager.getConfiguredNetwork(wcmNetwork.getKey())) + .thenReturn(wcmNetwork); + mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); + // verify we canceled the timeout alarm. + verify(mAlarmManager).cancel(mConnectionTimeoutAlarmListenerArgumentCaptor.getValue()); + // Verify that we triggered a disconnect. + verify(mClientModeImpl, times(2)).disconnectCommand(); + verify(mWifiConfigManager).removeNetwork( + TEST_NETWORK_ID_1, TEST_UID_1, TEST_PACKAGE_NAME_1); + // Re-enable connectivity manager . + verify(mWifiConnectivityManager).setSpecificNetworkRequestInProgress(false); + } + + /** * Verify handling of request release after connecting to the network. */ @Test @@ -1601,9 +1631,10 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { wcmNetwork.networkId = TEST_NETWORK_ID_1; wcmNetwork.creatorUid = TEST_UID_1; wcmNetwork.creatorName = TEST_PACKAGE_NAME_1; + wcmNetwork.shared = false; wcmNetwork.fromWifiNetworkSpecifier = true; wcmNetwork.ephemeral = true; - when(mWifiConfigManager.getConfiguredNetwork(mSelectedNetwork.getKey())) + when(mWifiConfigManager.getConfiguredNetwork(wcmNetwork.getKey())) .thenReturn(wcmNetwork); mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); // Verify that we triggered a disconnect. |