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

Commit 903d445f authored by Xia Wang's avatar Xia Wang Committed by Android Git Automerger
Browse files

am 131ce67d: Merge "DO NOT MERGE" into gingerbread

Merge commit '131ce67d' into gingerbread-plus-aosp

* commit '131ce67d':
  DO NOT MERGE
parents 2a5db6d4 131ce67d
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