This repository was archived by the owner on Nov 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
components/feature/session/src
main/java/mozilla/components/feature/session
test/java/mozilla/components/feature/session Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,12 @@ class SessionIntentProcessor(
20
20
val url = intent.dataString
21
21
if (TextUtils .isEmpty(url)) {
22
22
false
23
+ } else {
24
+ // TODO switch to loadUrlInNewTab
25
+ // https://github.com/mozilla-mobile/android-components/issues/136
26
+ sessionUseCases.loadUrl.invoke(url)
27
+ true
23
28
}
24
-
25
- // TODO switch to loadUrlInNewTab, once available
26
- sessionUseCases.loadUrl.invoke(url)
27
- true
28
29
}
29
30
30
31
private val defaultHandlers: MutableMap <String , IntentHandler > by lazy {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import org.junit.Test
15
15
import org.junit.runner.RunWith
16
16
import org.mockito.Mockito.`when`
17
17
import org.mockito.Mockito.mock
18
+ import org.mockito.Mockito.never
18
19
import org.mockito.Mockito.verify
19
20
import org.mockito.Mockito.verifyZeroInteractions
20
21
import org.robolectric.RobolectricTestRunner
@@ -33,12 +34,16 @@ class SessionIntentProcessorTest {
33
34
}
34
35
35
36
@Test
36
- fun testProcessWIthDefaultHandlers () {
37
+ fun testProcessWithDefaultHandlers () {
37
38
val handler = SessionIntentProcessor (useCases)
38
39
val intent = mock(Intent ::class .java)
39
40
`when `(intent.action).thenReturn(Intent .ACTION_VIEW )
40
- `when `(intent.dataString).thenReturn(" http://mozilla.org" )
41
41
42
+ `when `(intent.dataString).thenReturn(" " )
43
+ handler.process(intent)
44
+ verify(engineSession, never()).loadUrl(" " )
45
+
46
+ `when `(intent.dataString).thenReturn(" http://mozilla.org" )
42
47
handler.process(intent)
43
48
verify(engineSession).loadUrl(" http://mozilla.org" )
44
49
}
You can’t perform that action at this time.
0 commit comments