From 7590db5bbdf387132ff02e6cd78a77e2bf0122d2 Mon Sep 17 00:00:00 2001 From: joshliebe Date: Thu, 19 Dec 2024 14:20:54 +0000 Subject: [PATCH] Remove test data dir from WebViewDataManagerTest --- .../app/browser/WebViewDataManagerTest.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/androidTest/java/com/duckduckgo/app/browser/WebViewDataManagerTest.kt b/app/src/androidTest/java/com/duckduckgo/app/browser/WebViewDataManagerTest.kt index 44070bfd55a4..5075dd161af6 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/browser/WebViewDataManagerTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/browser/WebViewDataManagerTest.kt @@ -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 @@ -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, @@ -70,11 +68,6 @@ class WebViewDataManagerTest { CoroutineTestRule().testDispatcherProvider, ) - @Before - fun setup() { - context.applicationInfo.dataDir = dataDir - } - @Test fun whenDataClearedThenWebViewHistoryCleared() = runTest { withContext(Dispatchers.Main) { @@ -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"), ) } @@ -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"), ) } @@ -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"), ) }