Merge "Fix a way for this test to flake."

This commit is contained in:
Chalard Jean
2020-10-09 04:29:17 +00:00
committed by Gerrit Code Review

View File

@@ -224,6 +224,16 @@ public class ConnectivityManagerTest {
if (mCtsNetUtils.cellConnectAttempted()) { if (mCtsNetUtils.cellConnectAttempted()) {
mCtsNetUtils.disconnectFromCell(); 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);
}
} }
/** /**