@@ -58,8 +58,22 @@ class InMobiAdapterUtilsTest {
5858 @Test
5959 fun setIsAgeRestricted_whenCOPPASet_setsAgeRestrictedTrueOnInMobiSDK () {
6060 val inMobiSdkWrapper = mock<InMobiSdkWrapper >()
61- setCOPPAOnMobileAdsRequestConfiguration(
62- RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE
61+ setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration(
62+ RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE ,
63+ RequestConfiguration .TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED ,
64+ )
65+
66+ InMobiAdapterUtils .setIsAgeRestricted(inMobiSdkWrapper)
67+
68+ verify(inMobiSdkWrapper).setIsAgeRestricted(true )
69+ }
70+
71+ @Test
72+ fun setIsAgeRestricted_whenUnderAgeConsentSet_setsAgeRestrictedTrueOnInMobiSDK () {
73+ val inMobiSdkWrapper = mock<InMobiSdkWrapper >()
74+ setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration(
75+ RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED ,
76+ RequestConfiguration .TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE ,
6377 )
6478
6579 InMobiAdapterUtils .setIsAgeRestricted(inMobiSdkWrapper)
@@ -70,8 +84,22 @@ class InMobiAdapterUtilsTest {
7084 @Test
7185 fun setIsAgeRestricted_whenCOPPANotSet_setsAgeRestrictedFalseOnInMobiSDK () {
7286 val inMobiSdkWrapper = mock<InMobiSdkWrapper >()
73- setCOPPAOnMobileAdsRequestConfiguration(
74- RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE
87+ setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration(
88+ RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE ,
89+ RequestConfiguration .TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED ,
90+ )
91+
92+ InMobiAdapterUtils .setIsAgeRestricted(inMobiSdkWrapper)
93+
94+ verify(inMobiSdkWrapper).setIsAgeRestricted(false )
95+ }
96+
97+ @Test
98+ fun setIsAgeRestricted_whenUnderAgeConsentNotSet_setsAgeRestrictedFalseOnInMobiSDK () {
99+ val inMobiSdkWrapper = mock<InMobiSdkWrapper >()
100+ setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration(
101+ RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED ,
102+ RequestConfiguration .TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE ,
75103 )
76104
77105 InMobiAdapterUtils .setIsAgeRestricted(inMobiSdkWrapper)
@@ -82,8 +110,9 @@ class InMobiAdapterUtilsTest {
82110 @Test
83111 fun setIsAgeRestricted_whenCOPPANotSpecified_setIsAgeRestrictedIsNeverInvoked () {
84112 val inMobiSdkWrapper = mock<InMobiSdkWrapper >()
85- setCOPPAOnMobileAdsRequestConfiguration(
86- RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED
113+ setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration(
114+ RequestConfiguration .TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED ,
115+ RequestConfiguration .TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED ,
87116 )
88117
89118 InMobiAdapterUtils .setIsAgeRestricted(inMobiSdkWrapper)
@@ -241,9 +270,13 @@ class InMobiAdapterUtilsTest {
241270 assertThat(adError).isNull()
242271 }
243272
244- private fun setCOPPAOnMobileAdsRequestConfiguration ( value : Int ) {
273+ private fun setCOPPAAndUnderAgeOnMobileAdsRequestConfiguration ( coppa : Int , underAgeConsent : Int ) {
245274 val requestConfiguration =
246- MobileAds .getRequestConfiguration().toBuilder().setTagForChildDirectedTreatment(value).build()
275+ MobileAds .getRequestConfiguration()
276+ .toBuilder()
277+ .setTagForChildDirectedTreatment(coppa)
278+ .setTagForUnderAgeOfConsent(underAgeConsent)
279+ .build()
247280 MobileAds .setRequestConfiguration(requestConfiguration)
248281 }
249282
0 commit comments