Search in sources :

Example 1 with WifiAssociationTestRunner

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);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) Bundle(android.os.Bundle) WifiAssociationTestRunner(com.android.connectivitymanagertest.WifiAssociationTestRunner) WifiInfo(android.net.wifi.WifiInfo) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 2 with WifiAssociationTestRunner

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());
}
Also used : Bundle(android.os.Bundle) WifiAssociationTestRunner(com.android.connectivitymanagertest.WifiAssociationTestRunner) WifiInfo(android.net.wifi.WifiInfo)

Example 3 with WifiAssociationTestRunner

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);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) Bundle(android.os.Bundle) WifiAssociationTestRunner(com.android.connectivitymanagertest.WifiAssociationTestRunner) WifiInfo(android.net.wifi.WifiInfo) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 4 with WifiAssociationTestRunner

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);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) Bundle(android.os.Bundle) WifiAssociationTestRunner(com.android.connectivitymanagertest.WifiAssociationTestRunner) WifiInfo(android.net.wifi.WifiInfo) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 5 with WifiAssociationTestRunner

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);
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) Bundle(android.os.Bundle) WifiAssociationTestRunner(com.android.connectivitymanagertest.WifiAssociationTestRunner) WifiInfo(android.net.wifi.WifiInfo) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

WifiInfo (android.net.wifi.WifiInfo)6 Bundle (android.os.Bundle)6 WifiAssociationTestRunner (com.android.connectivitymanagertest.WifiAssociationTestRunner)6 WifiConfiguration (android.net.wifi.WifiConfiguration)5 LargeTest (android.test.suitebuilder.annotation.LargeTest)5