Fix TestNetworkAgentWrapper flakiness
The underlying issue here is that before aosp/986824 the call to waitForIdle is the local ConnectivityServiceTest function, but after that patch TestNetworkAgentWrapper has an identically named member that only wait for its own handler. Bug: 141341704 Test: ConnectivityServiceTest --generate-new-metrics 100 Change-Id: I38709cc69ec7a261c1c6e008abe03d2882e2083d
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user