Merge "Fix flaky CtsHostsideNetworkTests." into oc-mr1-dev
am: 91b52b4043 Change-Id: I8177cc215297566af2fb9ac206c5c425071fd3aa
This commit is contained in:
@@ -612,11 +612,15 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
|
||||
NetworkInfo info = null;
|
||||
for (int i = 1; i <= maxTries; i++) {
|
||||
info = mCm.getActiveNetworkInfo();
|
||||
if (info != null) {
|
||||
if (info == null) {
|
||||
Log.v(TAG, "No active network info on attempt #" + i
|
||||
+ "; sleeping 1s before polling again");
|
||||
} else if (mCm.isActiveNetworkMetered() != expected) {
|
||||
Log.v(TAG, "Wrong metered status for active network " + info + "; expected="
|
||||
+ expected + "; sleeping 1s before polling again");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
Log.v(TAG, "No active network info on attempt #" + i
|
||||
+ "; sleeping 1s before polling again");
|
||||
Thread.sleep(SECOND_IN_MS);
|
||||
}
|
||||
assertNotNull("No active network after " + maxTries + " attempts", info);
|
||||
|
||||
Reference in New Issue
Block a user