Search in sources :

Example 1 with ConnectivityManagerTestRunner

use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project platform_frameworks_base by android.

the class ConnectivityManagerMobileTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    ConnectivityManagerTestRunner mRunner = (ConnectivityManagerTestRunner) getInstrumentation();
    mSsid = mRunner.getWifiSsid();
    mPassword = mRunner.getWifiPassword();
    mWifiOnlyFlag = mRunner.isWifiOnly();
    // Each test case will start with cellular connection
    if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON) == 1) {
        logv("airplane is not disabled, disable it.");
        mCm.setAirplaneMode(false);
    }
    if (!mWifiOnlyFlag) {
        if (!waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED, LONG_TIMEOUT)) {
            // Note: When the test fails in setUp(), tearDown is not called. In that case,
            // the activity is destroyed which blocks the next test at "getActivity()".
            // tearDown() is called here to avoid that situation.
            tearDown();
            fail("Device is not connected to Mobile, setUp failed");
        }
    }
}
Also used : ConnectivityManagerTestRunner(com.android.connectivitymanagertest.ConnectivityManagerTestRunner)

Example 2 with ConnectivityManagerTestRunner

use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project android_frameworks_base by ParanoidAndroid.

the class WifiConnectionTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    mRunner = ((ConnectivityManagerTestRunner) getInstrumentation());
    mWifiManager = (WifiManager) mRunner.getContext().getSystemService(Context.WIFI_SERVICE);
    mAct = getActivity();
    networks = mAct.loadNetworkConfigurations();
    if (DEBUG) {
        printNetworkConfigurations();
    }
    // 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 : ConnectivityManagerTestRunner(com.android.connectivitymanagertest.ConnectivityManagerTestRunner) WifiInfo(android.net.wifi.WifiInfo)

Example 3 with ConnectivityManagerTestRunner

use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project android_frameworks_base by DirtyUnicorns.

the class ConnectivityManagerMobileTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    ConnectivityManagerTestRunner mRunner = (ConnectivityManagerTestRunner) getInstrumentation();
    mSsid = mRunner.getWifiSsid();
    mPassword = mRunner.getWifiPassword();
    mWifiOnlyFlag = mRunner.isWifiOnly();
    // Each test case will start with cellular connection
    if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON) == 1) {
        logv("airplane is not disabled, disable it.");
        mCm.setAirplaneMode(false);
    }
    if (!mWifiOnlyFlag) {
        if (!waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED, LONG_TIMEOUT)) {
            // Note: When the test fails in setUp(), tearDown is not called. In that case,
            // the activity is destroyed which blocks the next test at "getActivity()".
            // tearDown() is called here to avoid that situation.
            tearDown();
            fail("Device is not connected to Mobile, setUp failed");
        }
    }
}
Also used : ConnectivityManagerTestRunner(com.android.connectivitymanagertest.ConnectivityManagerTestRunner)

Example 4 with ConnectivityManagerTestRunner

use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project android_frameworks_base by AOSPA.

the class ConnectivityManagerMobileTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    ConnectivityManagerTestRunner mRunner = (ConnectivityManagerTestRunner) getInstrumentation();
    mSsid = mRunner.getWifiSsid();
    mPassword = mRunner.getWifiPassword();
    mWifiOnlyFlag = mRunner.isWifiOnly();
    // Each test case will start with cellular connection
    if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON) == 1) {
        logv("airplane is not disabled, disable it.");
        mCm.setAirplaneMode(false);
    }
    if (!mWifiOnlyFlag) {
        if (!waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED, LONG_TIMEOUT)) {
            // Note: When the test fails in setUp(), tearDown is not called. In that case,
            // the activity is destroyed which blocks the next test at "getActivity()".
            // tearDown() is called here to avoid that situation.
            tearDown();
            fail("Device is not connected to Mobile, setUp failed");
        }
    }
}
Also used : ConnectivityManagerTestRunner(com.android.connectivitymanagertest.ConnectivityManagerTestRunner)

Example 5 with ConnectivityManagerTestRunner

use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project android_frameworks_base by ResurrectionRemix.

the class ConnectivityManagerMobileTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    ConnectivityManagerTestRunner mRunner = (ConnectivityManagerTestRunner) getInstrumentation();
    mSsid = mRunner.getWifiSsid();
    mPassword = mRunner.getWifiPassword();
    mWifiOnlyFlag = mRunner.isWifiOnly();
    // Each test case will start with cellular connection
    if (Settings.Global.getInt(getInstrumentation().getContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON) == 1) {
        logv("airplane is not disabled, disable it.");
        mCm.setAirplaneMode(false);
    }
    if (!mWifiOnlyFlag) {
        if (!waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED, LONG_TIMEOUT)) {
            // Note: When the test fails in setUp(), tearDown is not called. In that case,
            // the activity is destroyed which blocks the next test at "getActivity()".
            // tearDown() is called here to avoid that situation.
            tearDown();
            fail("Device is not connected to Mobile, setUp failed");
        }
    }
}
Also used : ConnectivityManagerTestRunner(com.android.connectivitymanagertest.ConnectivityManagerTestRunner)

Aggregations

ConnectivityManagerTestRunner (com.android.connectivitymanagertest.ConnectivityManagerTestRunner)7 WifiInfo (android.net.wifi.WifiInfo)1 PowerManager (android.os.PowerManager)1