summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-02-24 02:03:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-24 02:03:01 +0000
commit87af62a5bfe014ff3e62a14d90e168741636da0c (patch)
tree31c3dc95dfe86a4b86df4fc7a9e66d92c2b9b512 /tests
parente6836f2c82e277ba412c7543aca239ace041940e (diff)
parente2dc63bb990eed0f1909f8f38cbfb0d2f4bc2a92 (diff)
Merge "Disable all networks in supplicant" into mm-wireless-dev
am: e2dc63bb99 * commit 'e2dc63bb990eed0f1909f8f38cbfb0d2f4bc2a92': Disable all networks in supplicant
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java12
2 files changed, 13 insertions, 14 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index e690d6091..96790f78c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyObject;
import static org.mockito.Mockito.anyString;
@@ -363,7 +362,6 @@ public class WifiConfigManagerTest {
@Test
public void testEnableAllNetworks() throws Exception {
addNetworks();
- when(mWifiNative.enableNetwork(anyInt(), anyBoolean())).thenReturn(true);
for (int userId : USER_IDS) {
switchUser(userId);
@@ -406,6 +404,7 @@ public class WifiConfigManagerTest {
// Try to select a network configuration.
final WifiNative wifiNative = createNewWifiNativeMock();
+ when(wifiNative.selectNetwork(config.networkId)).thenReturn(true);
final boolean success =
mConfigStore.selectNetwork(config, false, config.creatorUid);
if (!WifiConfigurationUtil.isVisibleToAnyProfile(config,
@@ -414,7 +413,7 @@ public class WifiConfigManagerTest {
// nothing changed.
assertFalse(success);
verify(wifiNative, never()).selectNetwork(anyInt());
- verify(wifiNative, never()).enableNetwork(anyInt(), anyBoolean());
+ verify(wifiNative, never()).enableNetwork(anyInt());
for (WifiConfiguration config2 : mConfiguredNetworks.valuesForAllUsers()) {
assertEquals(WifiConfiguration.Status.ENABLED, config2.status);
}
@@ -425,10 +424,8 @@ public class WifiConfigManagerTest {
assertTrue(success);
verify(wifiNative).selectNetwork(config.networkId);
verify(wifiNative, never()).selectNetwork(intThat(not(config.networkId)));
- verify(wifiNative).enableNetwork(config.networkId, true);
- verify(wifiNative, never()).enableNetwork(config.networkId, false);
- verify(wifiNative, never()).enableNetwork(intThat(not(config.networkId)),
- anyBoolean());
+ verify(wifiNative, never()).enableNetwork(config.networkId);
+ verify(wifiNative, never()).enableNetwork(intThat(not(config.networkId)));
for (WifiConfiguration config2 : mConfiguredNetworks.valuesForAllUsers()) {
if (WifiConfigurationUtil.isVisibleToAnyProfile(config2,
USER_PROFILES.get(userId))
@@ -739,8 +736,10 @@ public class WifiConfigManagerTest {
if (neitherUserConfigs.contains(config)) {
assertEquals(WifiConfiguration.Status.DISABLED, config.status);
} else {
- assertEquals(WifiConfiguration.Status.ENABLED, config.status);
+ // Only enabled in networkSelection.
+ assertTrue(config.getNetworkSelectionStatus().isNetworkEnabled());
}
+
}
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index 2cdbb0b7d..7ede141fd 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -616,13 +616,13 @@ public class WifiStateMachineTest {
}
private void enableNetworkAndVerifySuccess() throws Exception {
- when(mWifiNative.enableNetwork(0, true)).thenReturn(true);
+ when(mWifiNative.selectNetwork(0)).thenReturn(true);
mLooper.startAutoDispatch();
assertTrue(mWsm.syncEnableNetwork(mWsmAsyncChannel, 0, true));
mLooper.stopAutoDispatch();
- verify(mWifiNative).enableNetwork(0, true);
+ verify(mWifiNative).selectNetwork(0);
}
private void enableNetworkAndVerifyFailure() throws Exception {
@@ -630,7 +630,7 @@ public class WifiStateMachineTest {
assertFalse(mWsm.syncEnableNetwork(mWsmAsyncChannel, 0, true));
mLooper.stopAutoDispatch();
- verify(mWifiNative, never()).enableNetwork(anyInt(), anyBoolean());
+ verify(mWifiNative, never()).selectNetwork(anyInt());
}
/**
@@ -748,7 +748,7 @@ public class WifiStateMachineTest {
mWsm.syncEnableNetwork(mWsmAsyncChannel, 0, true);
mLooper.stopAutoDispatch();
- verify(mWifiNative).enableNetwork(0, true);
+ verify(mWifiNative).selectNetwork(0);
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();
@@ -782,7 +782,7 @@ public class WifiStateMachineTest {
mWsm.syncEnableNetwork(mWsmAsyncChannel, 0, true);
mLooper.stopAutoDispatch();
- verify(mWifiNative).enableNetwork(0, true);
+ verify(mWifiNative).selectNetwork(0);
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();
@@ -810,7 +810,7 @@ public class WifiStateMachineTest {
mWsm.syncEnableNetwork(mWsmAsyncChannel, 0, true);
mLooper.stopAutoDispatch();
- verify(mWifiNative).enableNetwork(0, true);
+ verify(mWifiNative).selectNetwork(0);
mWsm.sendMessage(WifiMonitor.NETWORK_DISCONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();