Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libraries #1299

Merged
merged 8 commits into from
Jul 24, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.duckduckgo.app.browser.downloader

import android.webkit.WebView
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import com.duckduckgo.app.browser.R
import com.nhaarman.mockitokotlin2.spy
Expand All @@ -37,6 +38,7 @@ class BlobConverterInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, spy is not supported on API < 24
mockito/mockito#2075 (comment)

fun whenConvertBlobIntoDataUriAndDownloadThenInjectJsCode() {
val jsToEvaluate = getJsToEvaluate().replace("%blobUrl%", blobUrl).replace("%contentType%", contentType)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.net.Uri
import android.webkit.WebResourceRequest
import android.webkit.WebView
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import com.duckduckgo.app.CoroutineTestRule
import com.duckduckgo.app.browser.logindetection.LoginDetectionJavascriptInterface.Companion.JAVASCRIPT_INTERFACE_NAME
Expand All @@ -42,6 +43,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenAddLoginDetectionThenJSInterfaceAdded() = coroutinesTestRule.runBlocking {
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
testee.addLoginDetection(webView) {}
Expand All @@ -50,6 +52,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionDisabledAndPageStartedEventThenNoWebViewInteractions() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(false)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -59,6 +62,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionDisabledAndInterceptRequestEventThenNoWebViewInteractions() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(false)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -69,6 +73,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionEnabledAndPageStartedEventThenJSLoginDetectionInjected() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(true)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -78,6 +83,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionEnabledAndLoginPostRequestCapturedThenJSLoginDetectionInjected() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(true)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -88,6 +94,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionEnabledAndNoLoginPostRequestCapturedThenNoWebViewInteractions() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(true)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -98,6 +105,7 @@ class JsLoginDetectorTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenLoginDetectionEnabledAndGetRequestCapturedThenNoWebViewInteractions() = coroutinesTestRule.runBlocking {
whenever(settingsDataStore.appLoginDetection).thenReturn(true)
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.duckduckgo.app.email

import android.webkit.WebView
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import com.duckduckgo.app.browser.DuckDuckGoUrlDetector
import com.duckduckgo.app.browser.R
Expand All @@ -38,6 +39,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectEmailAutofillJsAndUrlIsFromDuckDuckGoDomainThenInjectJsCode() {
val jsToEvaluate = getJsToEvaluate()
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -49,6 +51,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectEmailAutofillJsAndUrlIsFromDuckDuckGoSubdomainThenInjectJsCode() {
val jsToEvaluate = getJsToEvaluate()
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -60,6 +63,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectEmailAutofillJsAndUrlIsNotFromDuckDuckGoAndEmailIsSignedInThenInjectJsCode() {
whenever(mockEmailManager.isSignedIn()).thenReturn(true)
val jsToEvaluate = getJsToEvaluate()
Expand All @@ -72,6 +76,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectEmailAutofillJsAndUrlIsNotFromDuckDuckGoAndEmailIsNotSignedInThenDoNotInjectJsCode() {
whenever(mockEmailManager.isSignedIn()).thenReturn(false)
val jsToEvaluate = getJsToEvaluate()
Expand All @@ -84,6 +89,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectEmailAutofillJsTwiceThenDoNotInjectJsCodeTwice() {
whenever(mockEmailManager.isSignedIn()).thenReturn(true)
val jsToEvaluate = getJsToEvaluate()
Expand All @@ -97,6 +103,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenResetInjectedFlagCalledBetweenTwoInjectEmailJsCallsThenInjectJsCodeTwice() {
whenever(mockEmailManager.isSignedIn()).thenReturn(true)
val jsToEvaluate = getJsToEvaluate()
Expand All @@ -111,6 +118,7 @@ class EmailInjectorJsTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectAddressThenInjectJsCodeReplacingTheAlias() {
val address = "address"
val jsToEvaluate = getAliasJsToEvaluate().replace("%s", address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.duckduckgo.app.globalprivacycontrol
import android.webkit.WebView
import androidx.core.net.toUri
import androidx.test.annotation.UiThreadTest
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.globalprivacycontrol.GlobalPrivacyControlManager.Companion.GPC_HEADER
Expand Down Expand Up @@ -47,6 +48,7 @@ class GlobalPrivacyControlManagerTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectDoNotSellToDomAndGcpIsEnabledThenInjectToDom() {
val jsToEvaluate = getJsToEvaluate()
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand All @@ -59,6 +61,7 @@ class GlobalPrivacyControlManagerTest {

@UiThreadTest
@Test
@SdkSuppress(minSdkVersion = 24)
fun whenInjectDoNotSellToDomAndGcpIsNotEnabledThenDoNotInjectToDom() {
val jsToEvaluate = getJsToEvaluate()
val webView = spy(WebView(InstrumentationRegistry.getInstrumentation().targetContext))
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.30'
ext.spotless = "5.7.0"
ext.anvil_version = "2.2.0"
ext.kotlin_version = '1.5.20'
ext.spotless = "5.14.0"
ext.anvil_version = "2.3.3"

ext.min_sdk = 21
ext.target_sdk = 29
Expand Down
18 changes: 9 additions & 9 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#### suppress inspection "SpellCheckingInspection" for whole file
#### suppress inspection "UnusedProperty" for whole file

version.androidx.appcompat=1.2.0
version.androidx.appcompat=1.3.0
version.androidx.arch.core=2.1.0
version.androidx.constraintlayout=2.0.4
version.androidx.recyclerview=1.2.1
version.androidx.core=1.3.2
version.androidx.fragment=1.2.5
version.androidx.core=1.5.0
version.androidx.fragment=1.3.5
version.androidx.legacy=1.0.0
version.androidx.lifecycle=2.4.0-alpha01
version.androidx.room=2.2.6
version.androidx.room=2.3.0
version.androidx.swiperefreshlayout=1.1.0
version.androidx.test=1.4.0-beta02
version.androidx.webkit=1.3.0
version.androidx.work=2.4.0
version.androidx.webkit=1.4.0
version.androidx.work=2.5.0
version.androidx.security=1.1.0-alpha03
version.androidx.security-crypto=1.1.0-alpha03
version.com.airbnb.android..lottie=3.7.0
Expand All @@ -34,12 +34,12 @@ version.google.android.material=1.2.1
version.google.dagger=2.37
version.io.reactivex.rxjava2..rxandroid=2.0.2
version.io.reactivex.rxjava2..rxjava=2.2.9
version.kotlin=1.4.10
version.kotlin=1.5.20
Copy link
Collaborator

@aitorvs aitorvs Jul 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe remove the one we have in the main build.gradle and used this one. They are easy to get out of sync, in fact, they had different versions :/

version.kotlinx.coroutines=1.5.0
version.leakcanary=2.7
version.okhttp3=4.9.0
version.okhttp3=4.9.1
version.org.apache.commons..commons-math3=3.6.1
version.mockito=3.4.6
version.mockito=3.10.0
version.retrofit2=2.9.0
version.junit.junit=4.13.2
version.org.jsoup..jsoup=1.13.1
Expand Down