summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-12-11 22:33:31 -0800
committerIrfan Sheriff <isheriff@google.com>2011-12-12 16:47:02 -0800
commitcdc077c9dd6473b5abfad4edfaf1ff41a436caaf (patch)
tree3c26e24c256e4df0166c7bd00d46eb5646ba5e64 /core/tests
parentc1761e7fe10390d90b805f373b51ecaabf214dac (diff)
downloadframeworks_base-cdc077c9dd6473b5abfad4edfaf1ff41a436caaf.zip
frameworks_base-cdc077c9dd6473b5abfad4edfaf1ff41a436caaf.tar.gz
frameworks_base-cdc077c9dd6473b5abfad4edfaf1ff41a436caaf.tar.bz2
Fix configured network status
For a connected network, keep status as CURRENT. For a network, that is disconnected it should be ENABLED. A disabled network will have the status as DISABLED Also, add a unit test to ensure there is only one CURRENT network that is connected Change-Id: Iaa4a7124a0c372a8f6df3d846ae8c15d9b29cf13
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/unit/WifiClientTest.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/unit/WifiClientTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/unit/WifiClientTest.java
index e22b018..e44023b 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/unit/WifiClientTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/unit/WifiClientTest.java
@@ -271,4 +271,46 @@ public class WifiClientTest extends AndroidTestCase {
}
+ // Test case 6: test configured network status
+ @LargeTest
+ public void testWifiConfiguredNetworkStatus() {
+
+ /* Initialize */
+ mWifiManager.setWifiEnabled(false);
+ sleepAfterWifiEnable();
+
+ /* Ensure no network is CURRENT */
+ List<WifiConfiguration> configList = mWifiManager.getConfiguredNetworks();
+ for (WifiConfiguration c : configList) {
+ assertTrue(c.status != WifiConfiguration.Status.CURRENT);
+ }
+
+ /* Enable wifi */
+ mWifiManager.setWifiEnabled(true);
+ sleepAfterWifiEnable();
+
+ /* Ensure connected network is CURRENT */
+ String connectedSSID = mWifiManager.getConnectionInfo().getSSID();
+ configList = mWifiManager.getConfiguredNetworks();
+ for (WifiConfiguration c : configList) {
+ if (c.SSID.contains(connectedSSID)) {
+ assertTrue(c.status == WifiConfiguration.Status.CURRENT);
+ } else {
+ assertTrue(c.status != WifiConfiguration.Status.CURRENT);
+ }
+ }
+
+ /* Disable wifi */
+ mWifiManager.setWifiEnabled(false);
+ sleepAfterWifiEnable();
+
+ /* Ensure no network is CURRENT */
+ configList = mWifiManager.getConfiguredNetworks();
+ for (WifiConfiguration c : configList) {
+ assertTrue(c.status != WifiConfiguration.Status.CURRENT);
+ }
+ }
+
+
+
}