Validate cellular network in testSetAvoidUnvalidated() for accurate testing

* Modified testSetAvoidUnvalidated() to ensure the cellular network is
  validated before proceeding with default network switching tests.
* This prevents inaccurate test results when the cellular network is not
  usable, as the connectivity service won't switch to it if the Wi-Fi
  network becomes invalid.

Bug: 371818866
Test: TH
Change-Id: I458903392605a44470d5f226a36cfa983ec71aea
This commit is contained in:
Yuyang Huang 2024-10-08 18:34:57 +09:00
commit 99a17f99af

View file

@ -3061,6 +3061,7 @@ public class ConnectivityManagerTest {
try {
final Network cellNetwork = networkCallbackRule.requestCell();
ensureCellIsValidatedBeforeMockingValidationUrls();
final Network wifiNetwork = prepareValidatedNetwork();
final TestableNetworkCallback defaultCb =