Merge "Support for Terms & Conditions notification"
This commit is contained in:
@@ -54,12 +54,26 @@ class CaptivePortalDataTest {
|
||||
}
|
||||
.build()
|
||||
|
||||
private val dataFromPasspoint = CaptivePortalData.Builder()
|
||||
.setUserPortalUrl(Uri.parse("https://tc.example.com/passpoint"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT)
|
||||
.setVenueInfoUrl(Uri.parse("https://venue.example.com/passpoint"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT)
|
||||
.setCaptive(true)
|
||||
.apply {
|
||||
if (SdkLevel.isAtLeastS()) {
|
||||
setVenueFriendlyName("venue friendly name")
|
||||
}
|
||||
}
|
||||
.build()
|
||||
|
||||
private fun makeBuilder() = CaptivePortalData.Builder(data)
|
||||
|
||||
@Test
|
||||
fun testParcelUnparcel() {
|
||||
val fieldCount = if (SdkLevel.isAtLeastS()) 8 else 7
|
||||
val fieldCount = if (SdkLevel.isAtLeastS()) 10 else 7
|
||||
assertParcelSane(data, fieldCount)
|
||||
assertParcelSane(dataFromPasspoint, fieldCount)
|
||||
|
||||
assertParcelingIsLossless(makeBuilder().setUserPortalUrl(null).build())
|
||||
assertParcelingIsLossless(makeBuilder().setVenueInfoUrl(null).build())
|
||||
@@ -83,6 +97,27 @@ class CaptivePortalDataTest {
|
||||
assertNotEqualsAfterChange { it.setVenueFriendlyName("another friendly name") }
|
||||
assertNotEqualsAfterChange { it.setVenueFriendlyName(null) }
|
||||
}
|
||||
|
||||
assertEquals(dataFromPasspoint, CaptivePortalData.Builder(dataFromPasspoint).build())
|
||||
assertNotEqualsAfterChange { it.setUserPortalUrl(
|
||||
Uri.parse("https://tc.example.com/passpoint")) }
|
||||
assertNotEqualsAfterChange { it.setUserPortalUrl(
|
||||
Uri.parse("https://tc.example.com/passpoint"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_OTHER) }
|
||||
assertNotEqualsAfterChange { it.setUserPortalUrl(
|
||||
Uri.parse("https://tc.example.com/other"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) }
|
||||
assertNotEqualsAfterChange { it.setUserPortalUrl(
|
||||
Uri.parse("https://tc.example.com/passpoint"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_OTHER) }
|
||||
assertNotEqualsAfterChange { it.setVenueInfoUrl(
|
||||
Uri.parse("https://venue.example.com/passpoint")) }
|
||||
assertNotEqualsAfterChange { it.setVenueInfoUrl(
|
||||
Uri.parse("https://venue.example.com/other"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT) }
|
||||
assertNotEqualsAfterChange { it.setVenueInfoUrl(
|
||||
Uri.parse("https://venue.example.com/passpoint"),
|
||||
CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_OTHER) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -130,6 +165,22 @@ class CaptivePortalDataTest {
|
||||
assertEquals("venue friendly name", data.venueFriendlyName)
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
|
||||
fun testGetVenueInfoUrlSource() {
|
||||
assertEquals(CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_OTHER,
|
||||
data.venueInfoUrlSource)
|
||||
assertEquals(CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT,
|
||||
dataFromPasspoint.venueInfoUrlSource)
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.R)
|
||||
fun testGetUserPortalUrlSource() {
|
||||
assertEquals(CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_OTHER,
|
||||
data.userPortalUrlSource)
|
||||
assertEquals(CaptivePortalData.CAPTIVE_PORTAL_DATA_SOURCE_PASSPOINT,
|
||||
dataFromPasspoint.userPortalUrlSource)
|
||||
}
|
||||
|
||||
private fun CaptivePortalData.mutate(mutator: (CaptivePortalData.Builder) -> Unit) =
|
||||
CaptivePortalData.Builder(this).apply { mutator(this) }.build()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user