diff options
author | Chiachang Wang <chiachangwang@google.com> | 2020-07-03 08:07:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-07-03 08:07:04 +0000 |
commit | 442cffc1763fa0147ea2d30e36ef7b37ee57b38e (patch) | |
tree | 8b7512fee4d1bd63da72ec390143180613a23265 /tests | |
parent | c5c294b9da48b21e525b326184ecc019f2751b17 (diff) | |
parent | b002fd1e07d040b9c08852f63cfee2dbb7e811fe (diff) |
Merge "Update CapportData in CapportApiProbeResult to be nullable" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java b/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java index 00fe17c..a3ef532 100644 --- a/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java +++ b/tests/unit/src/com/android/server/connectivity/NetworkMonitorTest.java @@ -1152,7 +1152,29 @@ public class NetworkMonitorTest { } @Test - public void testIsCaptivePortal_CapportApiIsPortal() throws Exception { + public void testIsCaptivePortal_CapportApiIsPortalWithNullPortalUrl() throws Exception { + assumeTrue(CaptivePortalDataShimImpl.isSupported()); + setSslException(mHttpsConnection); + final long bytesRemaining = 10_000L; + final long secondsRemaining = 500L; + // Set content without partal url. + setApiContent(mCapportApiConnection, "{'captive': true," + + "'venue-info-url': '" + TEST_VENUE_INFO_URL + "'," + + "'bytes-remaining': " + bytesRemaining + "," + + "'seconds-remaining': " + secondsRemaining + "}"); + setPortal302(mHttpConnection); + + runNetworkTest(makeCapportLPs(), CELL_METERED_CAPABILITIES, VALIDATION_RESULT_PORTAL, + 0 /* probesSucceeded*/, TEST_LOGIN_URL); + + verify(mCapportApiConnection).getResponseCode(); + + verify(mHttpConnection, times(1)).getResponseCode(); + verify(mCallbacks, never()).notifyCaptivePortalDataChanged(any()); + } + + @Test + public void testIsCaptivePortal_CapportApiIsPortalWithValidPortalUrl() throws Exception { assumeTrue(CaptivePortalDataShimImpl.isSupported()); setSslException(mHttpsConnection); final long bytesRemaining = 10_000L; |