Skip to content

Commit 756fe38

Browse files
Tsu Chiang ChuangAndroid Git Automerger
authored andcommitted
am 6053b19: am bb69bde: am 3e70127: Merge "extend timeout to allow for more time for the device to connect." into ics-mr1
* commit '6053b195bcd49676b46b2257f6e1da04d0b4d9a5': extend timeout to allow for more time for the device to connect.
2 parents 7eed139 + 6053b19 commit 756fe38

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class ConnectionUtil {
5959
private static final int WAIT_FOR_SCAN_RESULT = 10 * 1000; // 10 seconds
6060
private static final int WIFI_SCAN_TIMEOUT = 50 * 1000;
6161
public static final int SHORT_TIMEOUT = 5 * 1000;
62-
public static final int LONG_TIMEOUT = 120 * 1000; // 2 minutes
62+
public static final int LONG_TIMEOUT = 5 * 60 * 1000; // 5 minutes
6363
private ConnectivityReceiver mConnectivityReceiver = null;
6464
private WifiReceiver mWifiReceiver = null;
6565
private DownloadReceiver mDownloadReceiver = null;
@@ -459,7 +459,13 @@ public boolean waitForNetworkState(int networkType, State expectedState, long ti
459459
if (mNetworkInfo == null) {
460460
Log.v(LOG_TAG, "Do not have networkInfo! Force fetch of network info.");
461461
mNetworkInfo = mCM.getActiveNetworkInfo();
462-
Assert.assertNotNull(mNetworkInfo);
462+
}
463+
// Still null after force fetch? Maybe the network did not have time to be brought
464+
// up yet.
465+
if (mNetworkInfo == null) {
466+
Log.v(LOG_TAG, "Failed to force fetch networkInfo. " +
467+
"The network is still not ready. Wait for the next broadcast");
468+
continue;
463469
}
464470
if ((mNetworkInfo.getType() != networkType) ||
465471
(mNetworkInfo.getState() != expectedState)) {

0 commit comments

Comments
 (0)