Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131ce67d authored by Xia Wang's avatar Xia Wang Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE" into gingerbread

parents 432c5b6c 8f076ec3
Loading
Loading
Loading
Loading
+38 −38
Original line number Diff line number Diff line
@@ -91,13 +91,14 @@ public class ConnectivityManagerMobileTest
    //                                      DISCONNECTING, DISCONNECTED, UNKNOWN
    private void waitForNetworkState(int networkType, State expectedState, long timeout) {
        long startTime = System.currentTimeMillis();
        // In case the broadcast is already sent out, no need to wait
        if (cmActivity.mCM.getNetworkInfo(networkType).getState() == expectedState) {
            return;
        } else {
        while (true) {
            if ((System.currentTimeMillis() - startTime) > timeout) {
                if (cmActivity.mCM.getNetworkInfo(networkType).getState() != expectedState) {
                    assertFalse("Wait for network state timeout", true);
                } else {
                    // the broadcast has been sent out. the state has been changed.
                    return;
                }
            }
            Log.v(LOG_TAG, "Wait for the connectivity state for network: " + networkType +
                    " to be " + expectedState.toString());
@@ -117,18 +118,18 @@ public class ConnectivityManagerMobileTest
            }
        }
    }
    }

    // Wait for Wifi state: WIFI_STATE_DISABLED, WIFI_STATE_DISABLING, WIFI_STATE_ENABLED,
    //                      WIFI_STATE_ENALBING, WIFI_STATE_UNKNOWN
    private void waitForWifiState(int expectedState, long timeout) {
        long startTime = System.currentTimeMillis();
        if (cmActivity.mWifiState == expectedState) {
            return;
        } else {
        while (true) {
            if ((System.currentTimeMillis() - startTime) > timeout) {
                if (cmActivity.mWifiState != expectedState) {
                    assertFalse("Wait for Wifi state timeout", true);
                } else {
                    return;
                }
            }
            Log.v(LOG_TAG, "Wait for wifi state to be: " + expectedState);
            synchronized (cmActivity.wifiObject) {
@@ -145,7 +146,6 @@ public class ConnectivityManagerMobileTest
            }
        }
    }
    }

    // Test case 1: Test enabling Wifi without associating with any AP
    @LargeTest