File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
androidTest/java/com/duckduckgo/app/browser
main/java/com/duckduckgo/app/browser Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,23 @@ class BrowserWebViewClientTest {
326
326
assertEquals(0 , jsPlugins.plugin.countStarted)
327
327
}
328
328
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
+
329
346
@UiThreadTest
330
347
@Test
331
348
fun whenOnReceivedHttpAuthRequestThenListenerNotified () {
@@ -1186,10 +1203,12 @@ class BrowserWebViewClientTest {
1186
1203
private class FakeJsInjectorPlugin : JsInjectorPlugin {
1187
1204
var countFinished = 0
1188
1205
var countStarted = 0
1206
+ var countInitted = 0
1189
1207
1190
1208
override suspend fun onInit (
1191
1209
webView : WebView ,
1192
1210
) {
1211
+ countInitted++
1193
1212
}
1194
1213
1195
1214
override suspend fun onPageStarted (
Original file line number Diff line number Diff line change @@ -469,7 +469,6 @@ class BrowserWebViewClient @Inject constructor(
469
469
}
470
470
}
471
471
472
- // TODO check new API
473
472
@UiThread
474
473
override fun onPageFinished (webView : WebView , url : String? ) {
475
474
logcat(VERBOSE ) { " onPageFinished webViewUrl: ${webView.url} URL: $url progress: ${webView.progress} " }
You can’t perform that action at this time.
0 commit comments