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