WifiSoftAPTestpublic class WifiSoftAPTest extends android.test.AndroidTestCase Test Wifi soft AP configuration |
Fields Summary |
---|
private android.net.wifi.WifiManager | mWifiManager | private android.net.wifi.WifiConfiguration | mWifiConfig | private final String | TAG | private final int | DURATION |
Methods Summary |
---|
protected void | setUp()
super.setUp();
mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
assertNotNull(mWifiManager);
assertTrue(mWifiManager.setWifiApEnabled(null, true));
mWifiConfig = mWifiManager.getWifiApConfiguration();
if (mWifiConfig != null) {
Log.v(TAG, "mWifiConfig is " + mWifiConfig.toString());
} else {
Log.v(TAG, "mWifiConfig is null.");
}
| protected void | tearDown()
Log.v(TAG, "turn off wifi tethering");
mWifiManager.setWifiApEnabled(null, false);
super.tearDown();
| public void | testApSsidWithAlphabet()
WifiConfiguration config = new WifiConfiguration();
config.SSID = "abcdefghijklmnopqrstuvwxyz";
config.allowedKeyManagement.set(KeyMgmt.NONE);
mWifiConfig = config;
assertTrue(mWifiManager.setWifiApEnabled(mWifiConfig, true));
try {
Thread.sleep(DURATION);
} catch (InterruptedException e) {
Log.v(TAG, "exception " + e.getStackTrace());
assertFalse(true);
}
assertNotNull(mWifiManager.getWifiApConfiguration());
assertEquals("wifi AP state is not enabled", WifiManager.WIFI_AP_STATE_ENABLED,
mWifiManager.getWifiApState());
|
|