Clean up for multiple validation result update
This is a follow-up commit for aosp/955431 to update commets and minor updates in unit test. Test: atest com.android.server.ConnectivityServiceTest#testCaptivePortalOnPartialConnectivity Bug: 130683832 Change-Id: I581eae8daeddd2c4c186e7b40e27fef2aaa7ab43 Merged-In: I9087ef791b3fee5399ba8e83ef9d8a544845a4dd Merged-In: I4424663292c5ad29eb7a888fa6975835721a5d2e (cherry picked from commit 3d3a9fff7b7fa0df4ee627cb082668e642d6f754)
This commit is contained in:
@@ -615,7 +615,7 @@ public class ConnectivityServiceTest {
|
||||
private void onValidationRequested() {
|
||||
try {
|
||||
if (mNmProvNotificationRequested
|
||||
&& mNmValidationResult == VALIDATION_RESULT_VALID) {
|
||||
&& ((mNmValidationResult & NETWORK_VALIDATION_RESULT_VALID) != 0)) {
|
||||
mNmCallbacks.hideProvisioningNotification();
|
||||
mNmProvNotificationRequested = false;
|
||||
}
|
||||
@@ -2781,10 +2781,10 @@ public class ConnectivityServiceTest {
|
||||
// Bring up a network with a captive portal.
|
||||
// Expect onAvailable callback of listen for NET_CAPABILITY_CAPTIVE_PORTAL.
|
||||
mWiFiNetworkAgent = new MockNetworkAgent(TRANSPORT_WIFI);
|
||||
String firstRedirectUrl = "http://example.com/firstPath";
|
||||
mWiFiNetworkAgent.connectWithCaptivePortal(firstRedirectUrl);
|
||||
String redirectUrl = "http://android.com/path";
|
||||
mWiFiNetworkAgent.connectWithCaptivePortal(redirectUrl);
|
||||
captivePortalCallback.expectAvailableCallbacksUnvalidated(mWiFiNetworkAgent);
|
||||
assertEquals(mWiFiNetworkAgent.waitForRedirectUrl(), firstRedirectUrl);
|
||||
assertEquals(mWiFiNetworkAgent.waitForRedirectUrl(), redirectUrl);
|
||||
|
||||
// Check that startCaptivePortalApp sends the expected command to NetworkMonitor.
|
||||
mCm.startCaptivePortalApp(mWiFiNetworkAgent.getNetwork());
|
||||
@@ -2794,7 +2794,7 @@ public class ConnectivityServiceTest {
|
||||
// Report that the captive portal is dismissed with partial connectivity, and check that
|
||||
// callbacks are fired.
|
||||
mWiFiNetworkAgent.setNetworkPartial();
|
||||
mWiFiNetworkAgent.mNetworkMonitor.forceReevaluation(Process.myUid());
|
||||
mCm.reportNetworkConnectivity(mWiFiNetworkAgent.getNetwork(), true);
|
||||
waitForIdle();
|
||||
captivePortalCallback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY,
|
||||
mWiFiNetworkAgent);
|
||||
@@ -2805,6 +2805,7 @@ public class ConnectivityServiceTest {
|
||||
false /* always */);
|
||||
waitForIdle();
|
||||
mCm.reportNetworkConnectivity(mWiFiNetworkAgent.getNetwork(), true);
|
||||
captivePortalCallback.expectCallback(CallbackState.LOST, mWiFiNetworkAgent);
|
||||
validatedCallback.expectAvailableCallbacksValidated(mWiFiNetworkAgent);
|
||||
NetworkCapabilities nc =
|
||||
validatedCallback.expectCapabilitiesWith(NET_CAPABILITY_PARTIAL_CONNECTIVITY,
|
||||
|
||||
Reference in New Issue
Block a user