Skip to content

Commit 8c70b80

Browse files
committed
Update tests
1 parent f941e49 commit 8c70b80

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/src/androidTest/java/com/duckduckgo/app/browser/BrowserWebViewClientTest.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,23 @@ class BrowserWebViewClientTest {
326326
assertEquals(0, jsPlugins.plugin.countStarted)
327327
}
328328

329+
@UiThreadTest
330+
@Test
331+
fun whenOnPageStartedThenReturnActiveExperiments() {
332+
val captor = argumentCaptor<List<Toggle>>()
333+
testee.onPageStarted(webView, EXAMPLE_URL, null)
334+
verify(listener).pageStarted(any(), captor.capture())
335+
assertTrue(captor.firstValue.contains(mockToggle))
336+
}
337+
338+
@UiThreadTest
339+
@Test
340+
fun whenTriggerJsInitThenInjectJsCode() {
341+
assertEquals(0, jsPlugins.plugin.countStarted)
342+
testee.triggerJSInit(webView)
343+
assertEquals(1, jsPlugins.plugin.countInitted)
344+
}
345+
329346
@UiThreadTest
330347
@Test
331348
fun whenOnReceivedHttpAuthRequestThenListenerNotified() {
@@ -1186,10 +1203,12 @@ class BrowserWebViewClientTest {
11861203
private class FakeJsInjectorPlugin : JsInjectorPlugin {
11871204
var countFinished = 0
11881205
var countStarted = 0
1206+
var countInitted = 0
11891207

11901208
override suspend fun onInit(
11911209
webView: WebView,
11921210
) {
1211+
countInitted++
11931212
}
11941213

11951214
override suspend fun onPageStarted(

app/src/main/java/com/duckduckgo/app/browser/BrowserWebViewClient.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ class BrowserWebViewClient @Inject constructor(
469469
}
470470
}
471471

472-
// TODO check new API
473472
@UiThread
474473
override fun onPageFinished(webView: WebView, url: String?) {
475474
logcat(VERBOSE) { "onPageFinished webViewUrl: ${webView.url} URL: $url progress: ${webView.progress}" }

0 commit comments

Comments
 (0)