Merge "Fix a way for this test to flake." am: 43370c622d am: ff47147c3a am: 15da51da4c

Original change: https://android-review.googlesource.com/c/platform/cts/+/1436794

Change-Id: I985f21d48aa647b4b07d1268717f67500c149cdc
This commit is contained in:
Chalard Jean
2020-10-09 05:18:48 +00:00
committed by Automerger Merge Worker

View File

@@ -224,6 +224,16 @@ public class ConnectivityManagerTest {
if (mCtsNetUtils.cellConnectAttempted()) {
mCtsNetUtils.disconnectFromCell();
}
// All tests in this class require a working Internet connection as they start. Make
// sure there is still one as they end that's ready to use for the next test to use.
final TestNetworkCallback callback = new TestNetworkCallback();
mCm.registerDefaultNetworkCallback(callback);
try {
assertNotNull("Couldn't restore Internet connectivity", callback.waitForAvailable());
} finally {
mCm.unregisterNetworkCallback(callback);
}
}
/**