Skip to content

Commit

Permalink
Remove test data dir from WebViewDataManagerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
joshliebe committed Dec 19, 2024
1 parent 564939f commit 7590db5
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
Expand All @@ -55,7 +54,6 @@ class WebViewDataManagerTest {
private val localStorageManager: LocalStorageManager = mock()
private val mockCrashLogger: CrashLogger = mock()
private val feature = FakeFeatureToggleFactory.create(AndroidBrowserConfigFeature::class.java)
private val dataDir: String = "test_data_dir"

private val testee = WebViewDataManager(
context,
Expand All @@ -70,11 +68,6 @@ class WebViewDataManagerTest {
CoroutineTestRule().testDispatcherProvider,
)

@Before
fun setup() {
context.applicationInfo.dataDir = dataDir
}

@Test
fun whenDataClearedThenWebViewHistoryCleared() = runTest {
withContext(Dispatchers.Main) {
Expand Down Expand Up @@ -160,7 +153,7 @@ class WebViewDataManagerTest {
testee.clearData(webView, mockStorage)

verify(mockFileDeleter).deleteContents(
File(dataDir, "app_webview"),
File(context.applicationInfo.dataDir, "app_webview"),
listOf("Default", "Cookies"),
)
}
Expand All @@ -175,7 +168,7 @@ class WebViewDataManagerTest {
testee.clearData(webView, mockStorage)

verify(mockFileDeleter).deleteContents(
File(dataDir, "app_webview/Default"),
File(context.applicationInfo.dataDir, "app_webview/Default"),
listOf("Cookies"),
)
}
Expand All @@ -190,7 +183,7 @@ class WebViewDataManagerTest {
testee.clearData(webView, mockStorage)

verify(mockFileDeleter).deleteContents(
File(dataDir, "app_webview/Default"),
File(context.applicationInfo.dataDir, "app_webview/Default"),
listOf("Cookies", "Local Storage"),
)
}
Expand Down

0 comments on commit 7590db5

Please sign in to comment.