2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-05 21:20:45 +00:00

Bug 1818015 - Use custom tab to show privacy notice during onboarding

(cherry picked from commit 8661a63a378da6c76fede176824e8c8655d9d560)
This commit is contained in:
Alexandru2909 2023-02-23 15:19:03 +02:00 committed by mergify[bot]
parent 17a74db488
commit 3c261a98f5
3 changed files with 22 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import androidx.test.uiautomator.UiDevice
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest
@ -211,6 +212,7 @@ class OnboardingTest {
}
@Test
@Ignore("Failing due to changes from https://github.com/mozilla-mobile/firefox-android/pull/969")
fun youControlYourDataCardTest() {
homeScreen {
verifyPrivacyNoticeCard()

View File

@ -516,10 +516,11 @@ class DefaultSessionControlController(
}
override fun handleReadPrivacyNoticeClicked() {
activity.openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
newTab = true,
from = BrowserDirection.FromHome,
activity.startActivity(
SupportUtils.createCustomTabIntent(
activity,
SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
),
)
}

View File

@ -11,8 +11,11 @@ import io.mockk.Runs
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
import io.mockk.mockkObject
import io.mockk.mockkStatic
import io.mockk.slot
import io.mockk.spyk
import io.mockk.unmockkObject
import io.mockk.unmockkStatic
import io.mockk.verify
import kotlinx.coroutines.ExperimentalCoroutinesApi
@ -963,14 +966,22 @@ class DefaultSessionControlControllerTest {
@Test
fun handleReadPrivacyNoticeClicked() {
mockkObject(SupportUtils)
val urlCaptor = slot<String>()
every { SupportUtils.createCustomTabIntent(any(), capture(urlCaptor)) } returns mockk()
createController().handleReadPrivacyNoticeClicked()
verify {
activity.openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
newTab = true,
from = BrowserDirection.FromHome,
activity.startActivity(
any(),
)
}
assertEquals(
SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
urlCaptor.captured,
)
unmockkObject(SupportUtils)
}
@Test