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");
}
}
}
use of com.android.connectivitymanagertest.ConnectivityManagerTestRunner in project android_frameworks_base by crdroidandroid.
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");
}
}
}
Aggregations