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;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiEnterpriseConfig;
|
||||
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 int ENABLE_DELAY = 10000;
|
||||
|
||||
private boolean hasWifi() {
|
||||
return getContext().getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_WIFI);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@@ -42,10 +48,16 @@ public class WifiEnterpriseConfigTest extends AndroidTestCase {
|
||||
assertNotNull(mWifiManager);
|
||||
mWifiManager.setWifiEnabled(true);
|
||||
Thread.sleep(ENABLE_DELAY);
|
||||
assertTrue(mWifiManager.isWifiEnabled());
|
||||
if (hasWifi()) {
|
||||
assertTrue(mWifiManager.isWifiEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
public void testSettersAndGetters() {
|
||||
if (!hasWifi()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WifiEnterpriseConfig config = new WifiEnterpriseConfig();
|
||||
assertTrue(config.getEapMethod() == Eap.NONE);
|
||||
config.setEapMethod(Eap.PEAP);
|
||||
@@ -78,6 +90,10 @@ public class WifiEnterpriseConfigTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
public void testAddEapNetwork() {
|
||||
if (!hasWifi()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
WifiEnterpriseConfig enterpriseConfig = new WifiEnterpriseConfig();
|
||||
enterpriseConfig.setEapMethod(Eap.PWD);
|
||||
|
||||
Reference in New Issue
Block a user