diff options
author | Roshan Pius <rpius@google.com> | 2019-03-25 13:56:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-25 13:56:27 +0000 |
commit | 38d9f0d26b21c4b95c5cc8b3ae9af3ab82f7f95e (patch) | |
tree | db80e6519f9b5629235faeefd17169680b172e08 /tests | |
parent | 83978887012ef96030055b9c71752677d1649735 (diff) | |
parent | f94353bbd50b7afdcdc01bf88f532acb117db21a (diff) |
Merge "Revert "WifiConfigManager: Temporarily blacklist on disconnect""
Diffstat (limited to 'tests')
5 files changed, 17 insertions, 55 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 86fb45f2f..0c0ceda8b 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -3309,40 +3309,4 @@ public class ClientModeImplTest { assertEquals(OP_PACKAGE_NAME, mCmi.getWifiInfo().getNetworkSuggestionOrSpecifierPackageName()); } - - /** - * Verifies the handling of disconnect initiated from API surface when connected to a network. - */ - @Test - public void testExternalDisconnectWhenConnected() throws Exception { - connect(); - - mCmi.disconnectCommandExternal(); // Simulate settings invoking this. - mLooper.dispatchAll(); - - verify(mWifiNative).disconnect(WIFI_IFACE_NAME); - verify(mWifiMetrics).logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT, - StaEvent.DISCONNECT_API); - // verify that we temp blacklist the network. - verify(mWifiConfigManager).updateNetworkSelectionStatus(0, - WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WIFI_MANAGER_DISCONNECT); - } - - /** - * Verifies the handling of disconnect initiated internally when connected to a network. - */ - @Test - public void testInternalDisconnectWhenConnected() throws Exception { - connect(); - - mCmi.disconnectCommandInternal(); // Internal stack initiated disconnect. - mLooper.dispatchAll(); - - verify(mWifiNative).disconnect(WIFI_IFACE_NAME); - verify(mWifiMetrics).logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT, - StaEvent.DISCONNECT_GENERIC); - // verify that we don't temp blacklist the network. - verify(mWifiConfigManager, never()).updateNetworkSelectionStatus(0, - WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WIFI_MANAGER_DISCONNECT); - } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index ba96ff877..36e7d482e 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -16,8 +16,6 @@ package com.android.server.wifi; -import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX; - import static org.junit.Assert.*; import static org.mockito.Mockito.*; @@ -4982,7 +4980,7 @@ public class WifiConfigManagerTest { NetworkSelectionStatus.INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP, retrievedDisableTime); verifyUpdateNetworkStatus(retrievedNetwork, WifiConfiguration.Status.ENABLED); - } else if (reason < NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX) { + } else if (reason < NetworkSelectionStatus.DISABLED_TLS_VERSION_MISMATCH) { // For temporarily disabled networks, we need to ensure that the current status remains // until the threshold is crossed. assertEquals(temporaryDisableReasonCounter, retrievedDisableReasonCounter); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java index 0091ae106..60b91753e 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java @@ -567,7 +567,7 @@ public class WifiNetworkFactoryTest { // Release the network request. mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); // Verify that we did not trigger a disconnect because we've not yet connected. - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); // Re-enable connectivity manager . verify(mWifiConnectivityManager).setSpecificNetworkRequestInProgress(false); @@ -1405,7 +1405,7 @@ public class WifiNetworkFactoryTest { // Now release the network request. mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); // Verify that we triggered a disconnect. - verify(mClientModeImpl).disconnectCommandInternal(); + verify(mClientModeImpl).disconnectCommand(); // Re-enable connectivity manager . verify(mWifiConnectivityManager).setSpecificNetworkRequestInProgress(false); } @@ -1580,12 +1580,12 @@ public class WifiNetworkFactoryTest { verify(mWifiConnectivityManager, times(1)).setSpecificNetworkRequestInProgress(true); verify(mWifiScanner, times(2)).startScan(any(), any(), any()); // we shouldn't disconnect until the user accepts the next request. - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); // Remove the connected request1 & ensure we disconnect. mNetworkRequest.networkCapabilities.setNetworkSpecifier(specifier1); mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); - verify(mClientModeImpl).disconnectCommandInternal(); + verify(mClientModeImpl).disconnectCommand(); verifyNoMoreInteractions(mWifiConnectivityManager, mWifiScanner, mClientModeImpl, mAlarmManager); @@ -1630,7 +1630,7 @@ public class WifiNetworkFactoryTest { // We shouldn't explicitly disconnect, the new connection attempt will implicitly disconnect // from the connected network. - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); // Remove the stale request1 & ensure nothing happens (because it was replaced by the // second request) @@ -1643,7 +1643,7 @@ public class WifiNetworkFactoryTest { // Now remove the rejected request2, ensure we disconnect & re-enable auto-join. mNetworkRequest.networkCapabilities.setNetworkSpecifier(specifier2); mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); - verify(mClientModeImpl).disconnectCommandInternal(); + verify(mClientModeImpl).disconnectCommand(); verify(mWifiConnectivityManager).setSpecificNetworkRequestInProgress(false); verifyNoMoreInteractions(mWifiConnectivityManager, mWifiScanner, mClientModeImpl, @@ -1679,12 +1679,12 @@ public class WifiNetworkFactoryTest { // we shouldn't disconnect/re-enable auto-join until the connected request is released. verify(mWifiConnectivityManager, never()).setSpecificNetworkRequestInProgress(false); - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); // Remove the connected request1 & ensure we disconnect & ensure auto-join is re-enabled. mNetworkRequest.networkCapabilities.setNetworkSpecifier(specifier1); mWifiNetworkFactory.releaseNetworkFor(mNetworkRequest); - verify(mClientModeImpl).disconnectCommandInternal(); + verify(mClientModeImpl).disconnectCommand(); verify(mWifiConnectivityManager).setSpecificNetworkRequestInProgress(false); verifyNoMoreInteractions(mWifiConnectivityManager, mWifiScanner, mClientModeImpl, diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java index dd78012d3..ec35b1f8b 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java @@ -1257,7 +1257,7 @@ public class WifiNetworkSuggestionsManagerTest { // Now remove the network suggestion and ensure we did not trigger a disconnect. assertEquals(WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS, mWifiNetworkSuggestionsManager.remove(networkSuggestionList, TEST_PACKAGE_1)); - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); } /** @@ -1293,11 +1293,11 @@ public class WifiNetworkSuggestionsManagerTest { // Now remove one of the apps and ensure we did not trigger a disconnect. mWifiNetworkSuggestionsManager.removeApp(TEST_PACKAGE_1); - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); // Now remove the other app and ensure we trigger a disconnect. mWifiNetworkSuggestionsManager.removeApp(TEST_PACKAGE_2); - verify(mClientModeImpl).disconnectCommandInternal(); + verify(mClientModeImpl).disconnectCommand(); } /** @@ -1324,7 +1324,7 @@ public class WifiNetworkSuggestionsManagerTest { // Now remove the app and ensure we did not trigger a disconnect. mWifiNetworkSuggestionsManager.removeApp(TEST_PACKAGE_1); - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); } /** @@ -1356,7 +1356,7 @@ public class WifiNetworkSuggestionsManagerTest { // Now remove the app and ensure we did not trigger a disconnect. mWifiNetworkSuggestionsManager.removeApp(TEST_PACKAGE_1); - verify(mClientModeImpl, never()).disconnectCommandInternal(); + verify(mClientModeImpl, never()).disconnectCommand(); } /** diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index 937ebdc7d..d02ed91b6 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -2814,7 +2814,7 @@ public class WifiServiceImplTest { doThrow(new SecurityException()).when(mAppOpsManager) .noteOp(AppOpsManager.OPSTR_CHANGE_WIFI_STATE, Process.myUid(), TEST_PACKAGE_NAME); assertTrue(mWifiServiceImpl.disconnect(TEST_PACKAGE_NAME)); - verify(mClientModeImpl).disconnectCommandExternal(); + verify(mClientModeImpl).disconnectCommand(); } /** @@ -2826,7 +2826,7 @@ public class WifiServiceImplTest { public void testDisconnectWithChangeWifiStatePerm() throws Exception { assertFalse(mWifiServiceImpl.disconnect(TEST_PACKAGE_NAME)); verifyCheckChangePermission(TEST_PACKAGE_NAME); - verify(mClientModeImpl, never()).disconnectCommandExternal(); + verify(mClientModeImpl, never()).disconnectCommand(); } /** @@ -2845,7 +2845,7 @@ public class WifiServiceImplTest { } verifyCheckChangePermission(TEST_PACKAGE_NAME); - verify(mClientModeImpl, never()).disconnectCommandExternal(); + verify(mClientModeImpl, never()).disconnectCommand(); } @Test |