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

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

Change-Id: I2318a6d1a6d6ac4b142fc998f0c5efbe93b68707
This commit is contained in:
Chalard Jean
2020-10-09 04:53:54 +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);
}
}
/**