am 9b6f8ac9: Merge "Don’t run the WifiConfig tests if there is no Wifi." into klp-modular-dev
* commit '9b6f8ac99a0d9be7804120601b965277e9235d08': Don’t run the WifiConfig tests if there is no Wifi.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package android.net.wifi.cts;
|
package android.net.wifi.cts;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiEnterpriseConfig;
|
import android.net.wifi.WifiEnterpriseConfig;
|
||||||
import android.net.wifi.WifiEnterpriseConfig.Eap;
|
import android.net.wifi.WifiEnterpriseConfig.Eap;
|
||||||
@@ -34,6 +35,11 @@ public class WifiEnterpriseConfigTest extends AndroidTestCase {
|
|||||||
private static final String ANON_IDENTITY = "anonidentity";
|
private static final String ANON_IDENTITY = "anonidentity";
|
||||||
private static final int ENABLE_DELAY = 10000;
|
private static final int ENABLE_DELAY = 10000;
|
||||||
|
|
||||||
|
private boolean hasWifi() {
|
||||||
|
return getContext().getPackageManager().hasSystemFeature(
|
||||||
|
PackageManager.FEATURE_WIFI);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
@@ -42,10 +48,16 @@ public class WifiEnterpriseConfigTest extends AndroidTestCase {
|
|||||||
assertNotNull(mWifiManager);
|
assertNotNull(mWifiManager);
|
||||||
mWifiManager.setWifiEnabled(true);
|
mWifiManager.setWifiEnabled(true);
|
||||||
Thread.sleep(ENABLE_DELAY);
|
Thread.sleep(ENABLE_DELAY);
|
||||||
|
if (hasWifi()) {
|
||||||
assertTrue(mWifiManager.isWifiEnabled());
|
assertTrue(mWifiManager.isWifiEnabled());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testSettersAndGetters() {
|
public void testSettersAndGetters() {
|
||||||
|
if (!hasWifi()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WifiEnterpriseConfig config = new WifiEnterpriseConfig();
|
WifiEnterpriseConfig config = new WifiEnterpriseConfig();
|
||||||
assertTrue(config.getEapMethod() == Eap.NONE);
|
assertTrue(config.getEapMethod() == Eap.NONE);
|
||||||
config.setEapMethod(Eap.PEAP);
|
config.setEapMethod(Eap.PEAP);
|
||||||
@@ -78,6 +90,10 @@ public class WifiEnterpriseConfigTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAddEapNetwork() {
|
public void testAddEapNetwork() {
|
||||||
|
if (!hasWifi()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WifiConfiguration config = new WifiConfiguration();
|
WifiConfiguration config = new WifiConfiguration();
|
||||||
WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig();
|
WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig();
|
||||||
enterpriseConfig.setEapMethod(Eap.PWD);
|
enterpriseConfig.setEapMethod(Eap.PWD);
|
||||||
|
|||||||
Reference in New Issue
Block a user