Merge "Fix TestNetworkAgentWrapper flakiness"

am: b96ef8f5c0

Change-Id: I7a20018464b1df7399fd093d2b3259aeb0bca194
This commit is contained in:
Chalard Jean
2019-09-25 02:16:15 -07:00
committed by android-build-merger

View File

@@ -504,6 +504,8 @@ public class ConnectivityServiceTest {
// Waits for the NetworkAgent to be registered, which includes the creation of the // Waits for the NetworkAgent to be registered, which includes the creation of the
// NetworkMonitor. // NetworkMonitor.
waitForIdle(TIMEOUT_MS); waitForIdle(TIMEOUT_MS);
HandlerUtilsKt.waitForIdle(mCsHandlerThread, TIMEOUT_MS);
HandlerUtilsKt.waitForIdle(ConnectivityThread.get(), TIMEOUT_MS);
} }
@Override @Override
@@ -4315,16 +4317,16 @@ public class ConnectivityServiceTest {
assertFalse(mCm.isNetworkSupported(TYPE_NONE)); assertFalse(mCm.isNetworkSupported(TYPE_NONE));
assertThrows(IllegalArgumentException.class, assertThrows(IllegalArgumentException.class,
() -> { mCm.networkCapabilitiesForType(TYPE_NONE); }); () -> mCm.networkCapabilitiesForType(TYPE_NONE));
Class<UnsupportedOperationException> unsupported = UnsupportedOperationException.class; Class<UnsupportedOperationException> unsupported = UnsupportedOperationException.class;
assertThrows(unsupported, () -> { mCm.startUsingNetworkFeature(TYPE_WIFI, ""); }); assertThrows(unsupported, () -> mCm.startUsingNetworkFeature(TYPE_WIFI, ""));
assertThrows(unsupported, () -> { mCm.stopUsingNetworkFeature(TYPE_WIFI, ""); }); assertThrows(unsupported, () -> mCm.stopUsingNetworkFeature(TYPE_WIFI, ""));
// TODO: let test context have configuration application target sdk version // TODO: let test context have configuration application target sdk version
// and test that pre-M requesting for TYPE_NONE sends back APN_REQUEST_FAILED // and test that pre-M requesting for TYPE_NONE sends back APN_REQUEST_FAILED
assertThrows(unsupported, () -> { mCm.startUsingNetworkFeature(TYPE_NONE, ""); }); assertThrows(unsupported, () -> mCm.startUsingNetworkFeature(TYPE_NONE, ""));
assertThrows(unsupported, () -> { mCm.stopUsingNetworkFeature(TYPE_NONE, ""); }); assertThrows(unsupported, () -> mCm.stopUsingNetworkFeature(TYPE_NONE, ""));
assertThrows(unsupported, () -> { mCm.requestRouteToHostAddress(TYPE_NONE, null); }); assertThrows(unsupported, () -> mCm.requestRouteToHostAddress(TYPE_NONE, null));
} }
@Test @Test