|
|
|
@ -35,8 +35,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
intent.flags = FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
|
|
|
|
|
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|
|
|
|
|
@ -54,8 +56,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
intent.action = NewTabShortcutIntentProcessor.ACTION_OPEN_PRIVATE_TAB
|
|
|
|
|
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|
|
|
|
|
@ -74,8 +78,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
intent.action = NewTabShortcutIntentProcessor.ACTION_OPEN_TAB
|
|
|
|
|
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|
|
|
|
|
@ -83,7 +89,7 @@ class IntentReceiverActivityTest {
|
|
|
|
|
val actualIntent = shadow.peekNextStartedActivity()
|
|
|
|
|
|
|
|
|
|
assertEquals(HomeActivity::class.java.name, actualIntent.component?.className)
|
|
|
|
|
assertEquals(false, actualIntent.hasExtra(HomeActivity.PRIVATE_BROWSING_MODE))
|
|
|
|
|
assertEquals(false, actualIntent.getBooleanExtra(HomeActivity.PRIVATE_BROWSING_MODE, false))
|
|
|
|
|
assertEquals(false, actualIntent.getBooleanExtra(HomeActivity.OPEN_TO_BROWSER, true))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -92,8 +98,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
testContext.settings().openLinksInAPrivateTab = false
|
|
|
|
|
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|
|
|
|
|
@ -101,7 +109,7 @@ class IntentReceiverActivityTest {
|
|
|
|
|
val actualIntent = shadow.peekNextStartedActivity()
|
|
|
|
|
|
|
|
|
|
assertEquals(HomeActivity::class.java.name, actualIntent.component?.className)
|
|
|
|
|
assertEquals(false, actualIntent.getBooleanExtra(HomeActivity.OPEN_TO_BROWSER, true))
|
|
|
|
|
assertEquals(true, actualIntent.getBooleanExtra(HomeActivity.OPEN_TO_BROWSER, true))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -109,8 +117,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
testContext.settings().openLinksInAPrivateTab = true
|
|
|
|
|
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.privateIntentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.privateCustomTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|
|
|
|
|
@ -125,8 +135,10 @@ class IntentReceiverActivityTest {
|
|
|
|
|
testContext.settings().openLinksInAPrivateTab = false
|
|
|
|
|
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.intentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
@ -142,6 +154,8 @@ class IntentReceiverActivityTest {
|
|
|
|
|
testContext.settings().openLinksInAPrivateTab = false
|
|
|
|
|
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.customTabIntentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
@ -161,7 +175,9 @@ class IntentReceiverActivityTest {
|
|
|
|
|
testContext.settings().openLinksInAPrivateTab = true
|
|
|
|
|
|
|
|
|
|
val intent = Intent()
|
|
|
|
|
`when`(testContext.components.intentProcessors.migrationIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
`when`(testContext.components.intentProcessors.privateCustomTabIntentProcessor.process(intent)).thenReturn(true)
|
|
|
|
|
`when`(testContext.components.intentProcessors.fennecPageShortcutIntentProcessor.process(intent)).thenReturn(false)
|
|
|
|
|
|
|
|
|
|
val activity = Robolectric.buildActivity(IntentReceiverActivity::class.java, intent).get()
|
|
|
|
|
activity.processIntent(intent)
|
|
|
|
|