use of com.android.connectivitymanagertest.WifiAssociationTestRunner in project platform_frameworks_base by android.
the class WifiAssociationTest method testWifiAssociation.
/**
* Test that the wifi can associate with a given access point.
*/
@LargeTest
public void testWifiAssociation() {
WifiAssociationTestRunner runner = (WifiAssociationTestRunner) getInstrumentation();
Bundle arguments = runner.getArguments();
String ssid = arguments.getString("ssid");
assertNotNull("ssid is empty", ssid);
String securityTypeStr = arguments.getString("security-type");
assertNotNull("security-type is empty", securityTypeStr);
SecurityType securityType = SecurityType.valueOf(securityTypeStr);
String password = arguments.getString("password");
assertTrue("enable Wifi failed", enableWifi());
WifiInfo wi = mWifiManager.getConnectionInfo();
logv("%s", wi);
assertNotNull("no active wifi info", wi);
WifiConfiguration config = getConfig(ssid, securityType, password);
logv("Network config: %s", config.toString());
connectToWifi(config);
}
use of com.android.connectivitymanagertest.WifiAssociationTestRunner in project android_frameworks_base by ParanoidAndroid.
the class WifiAssociationTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
WifiAssociationTestRunner mRunner = (WifiAssociationTestRunner) getInstrumentation();
mWifiManager = (WifiManager) mRunner.getContext().getSystemService(Context.WIFI_SERVICE);
mAct = getActivity();
Bundle arguments = mRunner.getArguments();
mSecurityType = arguments.getString("security-type");
mSsid = arguments.getString("ssid");
mPassword = arguments.getString("password");
mFrequencyBand = arguments.getString("frequency-band");
mBand = mRunner.mBand;
assertNotNull("Security type is empty", mSecurityType);
assertNotNull("Ssid is empty", mSsid);
validateFrequencyBand();
// enable Wifi and verify wpa_supplicant is started
assertTrue("enable Wifi failed", mAct.enableWifi());
sleep(2 * ConnectivityManagerTestActivity.SHORT_TIMEOUT, "interrupted while waiting for WPA_SUPPLICANT to start");
WifiInfo mConnection = mAct.mWifiManager.getConnectionInfo();
assertNotNull(mConnection);
assertTrue("wpa_supplicant is not started ", mAct.mWifiManager.pingSupplicant());
}
use of com.android.connectivitymanagertest.WifiAssociationTestRunner in project android_frameworks_base by AOSPA.
the class WifiAssociationTest method testWifiAssociation.
/**
* Test that the wifi can associate with a given access point.
*/
@LargeTest
public void testWifiAssociation() {
WifiAssociationTestRunner runner = (WifiAssociationTestRunner) getInstrumentation();
Bundle arguments = runner.getArguments();
String ssid = arguments.getString("ssid");
assertNotNull("ssid is empty", ssid);
String securityTypeStr = arguments.getString("security-type");
assertNotNull("security-type is empty", securityTypeStr);
SecurityType securityType = SecurityType.valueOf(securityTypeStr);
String password = arguments.getString("password");
String freqStr = arguments.getString("frequency-band");
if (freqStr != null) {
setFrequencyBand(freqStr);
}
assertTrue("enable Wifi failed", enableWifi());
WifiInfo wi = mWifiManager.getConnectionInfo();
logv("%s", wi);
assertNotNull("no active wifi info", wi);
WifiConfiguration config = getConfig(ssid, securityType, password);
logv("Network config: %s", config.toString());
connectToWifi(config);
}
use of com.android.connectivitymanagertest.WifiAssociationTestRunner in project android_frameworks_base by DirtyUnicorns.
the class WifiAssociationTest method testWifiAssociation.
/**
* Test that the wifi can associate with a given access point.
*/
@LargeTest
public void testWifiAssociation() {
WifiAssociationTestRunner runner = (WifiAssociationTestRunner) getInstrumentation();
Bundle arguments = runner.getArguments();
String ssid = arguments.getString("ssid");
assertNotNull("ssid is empty", ssid);
String securityTypeStr = arguments.getString("security-type");
assertNotNull("security-type is empty", securityTypeStr);
SecurityType securityType = SecurityType.valueOf(securityTypeStr);
String password = arguments.getString("password");
String freqStr = arguments.getString("frequency-band");
if (freqStr != null) {
setFrequencyBand(freqStr);
}
assertTrue("enable Wifi failed", enableWifi());
WifiInfo wi = mWifiManager.getConnectionInfo();
logv("%s", wi);
assertNotNull("no active wifi info", wi);
WifiConfiguration config = getConfig(ssid, securityType, password);
logv("Network config: %s", config.toString());
connectToWifi(config);
}
use of com.android.connectivitymanagertest.WifiAssociationTestRunner in project android_frameworks_base by crdroidandroid.
the class WifiAssociationTest method testWifiAssociation.
/**
* Test that the wifi can associate with a given access point.
*/
@LargeTest
public void testWifiAssociation() {
WifiAssociationTestRunner runner = (WifiAssociationTestRunner) getInstrumentation();
Bundle arguments = runner.getArguments();
String ssid = arguments.getString("ssid");
assertNotNull("ssid is empty", ssid);
String securityTypeStr = arguments.getString("security-type");
assertNotNull("security-type is empty", securityTypeStr);
SecurityType securityType = SecurityType.valueOf(securityTypeStr);
String password = arguments.getString("password");
String freqStr = arguments.getString("frequency-band");
if (freqStr != null) {
setFrequencyBand(freqStr);
}
assertTrue("enable Wifi failed", enableWifi());
WifiInfo wi = mWifiManager.getConnectionInfo();
logv("%s", wi);
assertNotNull("no active wifi info", wi);
WifiConfiguration config = getConfig(ssid, securityType, password);
logv("Network config: %s", config.toString());
connectToWifi(config);
}
Aggregations