Merge "Fix flaky CtsHostsideNetworkTests." into oc-mr1-dev

am: 91b52b4043

Change-Id: I8177cc215297566af2fb9ac206c5c425071fd3aa
This commit is contained in:
Jeff Sharkey
2017-09-14 16:56:06 +00:00
committed by android-build-merger

View File

@@ -612,11 +612,15 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
NetworkInfo info = null; NetworkInfo info = null;
for (int i = 1; i <= maxTries; i++) { for (int i = 1; i <= maxTries; i++) {
info = mCm.getActiveNetworkInfo(); 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; break;
} }
Log.v(TAG, "No active network info on attempt #" + i
+ "; sleeping 1s before polling again");
Thread.sleep(SECOND_IN_MS); Thread.sleep(SECOND_IN_MS);
} }
assertNotNull("No active network after " + maxTries + " attempts", info); assertNotNull("No active network after " + maxTries + " attempts", info);