You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.9 KiB
Kotlin
64 lines
1.9 KiB
Kotlin
5 years ago
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||
|
|
||
|
package org.mozilla.fenix.trackingprotection
|
||
|
|
||
|
import io.mockk.mockk
|
||
|
import io.mockk.verify
|
||
|
import org.junit.Test
|
||
|
|
||
|
import org.junit.Assert.assertEquals
|
||
|
|
||
|
class TrackingProtectionPanelInteractorTest {
|
||
|
|
||
|
@Test
|
||
|
fun openDetails() {
|
||
|
val store: TrackingProtectionStore = mockk(relaxed = true)
|
||
|
val interactor =
|
||
|
TrackingProtectionPanelInteractor(store, mockk(), mockk())
|
||
|
interactor.openDetails(TrackingProtectionCategory.FINGERPRINTERS, true)
|
||
|
verify {
|
||
|
store.dispatch(
|
||
|
TrackingProtectionAction.EnterDetailsMode(
|
||
|
TrackingProtectionCategory.FINGERPRINTERS,
|
||
|
true
|
||
|
)
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun selectTrackingProtectionSettings() {
|
||
|
var openSettings = false
|
||
|
val interactor = TrackingProtectionPanelInteractor(
|
||
|
mockk(),
|
||
|
mockk(),
|
||
|
{ openSettings = true }
|
||
|
)
|
||
|
interactor.selectTrackingProtectionSettings()
|
||
|
assertEquals(true, openSettings)
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun trackingProtectionToggled() {
|
||
|
var trackingProtectionNewValue: Boolean? = null
|
||
|
val interactor = TrackingProtectionPanelInteractor(
|
||
|
mockk(),
|
||
|
{ trackingProtectionNewValue = it },
|
||
|
mockk()
|
||
|
)
|
||
|
interactor.trackingProtectionToggled(true)
|
||
|
assertEquals(true, trackingProtectionNewValue)
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun onBackPressed() {
|
||
|
val store: TrackingProtectionStore = mockk(relaxed = true)
|
||
|
val interactor =
|
||
|
TrackingProtectionPanelInteractor(store, mockk(), mockk())
|
||
|
interactor.onBackPressed()
|
||
|
verify { store.dispatch(TrackingProtectionAction.ExitDetailsMode) }
|
||
|
}
|
||
|
}
|