Specify the expected VPN network callbacks.
The test expects validated VPN network callbacks. However, an unexpected Wi-Fi link bandwidth change during the test introduces flakiness. To enhance test stability, specify the expected callbacks to reduce flakiness. Bug: 401489016 Test: atest CtsHostsideNetworkTests --iteration Change-Id: I152ba5a4ff6c4a124db820f0eb58bb057e4dee5b
This commit is contained in:
parent
2e24584910
commit
8217a0e760
1 changed files with 5 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ import static android.net.ConnectivityManager.BLOCKED_REASON_LOCKDOWN_VPN;
|
|||
import static android.net.ConnectivityManager.BLOCKED_REASON_NONE;
|
||||
import static android.net.ConnectivityManager.FIREWALL_CHAIN_BACKGROUND;
|
||||
import static android.net.ConnectivityManager.TYPE_VPN;
|
||||
import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_TEST;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
|
||||
import static android.os.Process.INVALID_UID;
|
||||
|
|
@ -1024,7 +1025,10 @@ public class VpnTest {
|
|||
checkTrafficOnVpn();
|
||||
|
||||
final Network vpnNetwork = mCM.getActiveNetwork();
|
||||
myUidCallback.expectAvailableThenValidatedCallbacks(vpnNetwork, TIMEOUT_MS);
|
||||
myUidCallback.eventuallyExpect(CallbackEntry.NETWORK_CAPS_UPDATED,
|
||||
NETWORK_CALLBACK_TIMEOUT_MS,
|
||||
entry -> entry.getNetwork().equals(vpnNetwork)
|
||||
&& entry.getCaps().hasCapability(NET_CAPABILITY_VALIDATED));
|
||||
assertEquals(vpnNetwork, mCM.getActiveNetwork());
|
||||
assertNotEqual(defaultNetwork, vpnNetwork);
|
||||
maybeExpectVpnTransportInfo(vpnNetwork);
|
||||
|
|
|
|||
Loading…
Reference in a new issue