summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-05-21 10:20:29 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-05-21 10:20:29 -0700
commit0bdb0e4acbcab2a6464651493cfdaf60bc9f2180 (patch)
treef18ef4349936344d3c30676905268a41ea724792 /tests
parent966cdd11ad386d25bd168d650db0c47f0b091c16 (diff)
parent095121ada1c9ea6034e86606395de20cddcad9ba (diff)
WifiConfigManager: Do not disconnect on temp failure due to no internet
am: 095121ada1 Change-Id: I67598c3d301f9969b33d4c8e80fbbed3ea710dac
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java9
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java24
2 files changed, 30 insertions, 3 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 5b4917c7f..a4bc61aa1 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -628,12 +628,14 @@ public class WifiConfigManagerTest {
for (int i = 1; i <= assocRejectThreshold; i++) {
verifyUpdateNetworkSelectionStatus(result.getNetworkId(), assocRejectReason, i);
}
- verify(mWcmListener).onSavedNetworkTemporarilyDisabled(networkId);
+ verify(mWcmListener).onSavedNetworkTemporarilyDisabled(
+ networkId, NetworkSelectionStatus.DISABLED_ASSOCIATION_REJECTION);
// Now set it to permanently disabled.
verifyUpdateNetworkSelectionStatus(
result.getNetworkId(), NetworkSelectionStatus.DISABLED_BY_WIFI_MANAGER, 0);
- verify(mWcmListener).onSavedNetworkPermanentlyDisabled(networkId);
+ verify(mWcmListener).onSavedNetworkPermanentlyDisabled(
+ networkId, NetworkSelectionStatus.DISABLED_BY_WIFI_MANAGER);
// Now set it back to enabled.
verifyUpdateNetworkSelectionStatus(
@@ -660,7 +662,8 @@ public class WifiConfigManagerTest {
// disable it once to actually mark it temporarily disabled.
verifyUpdateNetworkSelectionStatus(
result.getNetworkId(), NetworkSelectionStatus.DISABLED_NO_INTERNET_TEMPORARY, 1);
- verify(mWcmListener).onSavedNetworkTemporarilyDisabled(networkId);
+ verify(mWcmListener).onSavedNetworkTemporarilyDisabled(
+ networkId, NetworkSelectionStatus.DISABLED_NO_INTERNET_TEMPORARY);
// Now set it back to enabled.
verifyUpdateNetworkSelectionStatus(
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
index 36530edb8..cb423617f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -16,6 +16,9 @@
package com.android.server.wifi;
+import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_AUTHENTICATION_FAILURE;
+import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_NO_INTERNET_TEMPORARY;
+
import static com.android.server.wifi.WifiConfigurationTestUtil.generateWifiConfig;
import static com.android.server.wifi.WifiStateMachine.WIFI_WORK_SOURCE;
@@ -134,6 +137,8 @@ public class WifiConnectivityManagerTest {
@Captor ArgumentCaptor<ScanResult> mCandidateScanResultCaptor;
@Captor ArgumentCaptor<ArrayList<String>> mBssidBlacklistCaptor;
@Captor ArgumentCaptor<ArrayList<String>> mSsidWhitelistCaptor;
+ @Captor ArgumentCaptor<WifiConfigManager.OnSavedNetworkUpdateListener>
+ mSavedNetworkUpdateListenerCaptor;
private MockResources mResources;
private int mFullScanMaxTxPacketRate;
private int mFullScanMaxRxPacketRate;
@@ -299,6 +304,8 @@ public class WifiConnectivityManagerTest {
pnoNetworkList.add(pnoNetwork);
when(wifiConfigManager.retrievePnoNetworkList()).thenReturn(pnoNetworkList);
when(wifiConfigManager.retrievePnoNetworkList()).thenReturn(pnoNetworkList);
+ doNothing().when(wifiConfigManager).setOnSavedNetworkUpdateListener(
+ mSavedNetworkUpdateListenerCaptor.capture());
return wifiConfigManager;
}
@@ -2040,4 +2047,21 @@ public class WifiConnectivityManagerTest {
assertTrue(capturedScanResults.contains(mScanData.getResults()[2]));
assertTrue(capturedScanResults.contains(mScanData.getResults()[3]));
}
+
+ /**
+ * Disabling the network temporarily due to lack of internet is a special reason for which we
+ * don't want WCM to trigger a disconnect (by removing the network from supplicant).
+ */
+ @Test
+ public void dontDisconnectIfNetworkTemporarilyDisabledDueToNoInternet() {
+ assertNotNull(mSavedNetworkUpdateListenerCaptor.getValue());
+
+ mSavedNetworkUpdateListenerCaptor.getValue()
+ .onSavedNetworkPermanentlyDisabled(0, DISABLED_AUTHENTICATION_FAILURE);
+ verify(mWifiConnectivityHelper).removeNetworkIfCurrent(0);
+
+ mSavedNetworkUpdateListenerCaptor.getValue()
+ .onSavedNetworkPermanentlyDisabled(0, DISABLED_NO_INTERNET_TEMPORARY);
+ // Don't remove network.
+ }
}