Skip to content

Commit 66074aa

Browse files
committed
Merge branch 'release/4.4.0'
2 parents 4b800c7 + da25a04 commit 66074aa

File tree

74 files changed

+1785
-320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1785
-320
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ before_script:
3333
- android-wait-for-emulator
3434
- adb shell input keyevent 82
3535

36-
script: ./gradlew build connectedCheck
36+
script:
37+
- ./gradlew build
38+
- ./gradlew connectedCheck -Porchestrator --info
39+
40+
after_failure:
41+
- cat /home/travis/build/duckduckgo/Android/app/build/outputs/androidTest-results/connected/*
3742

3843
notifications:
3944
slack:
40-
on_success: never
45+
on_success: change
4146
on_failure: change
4247
rooms:
4348
- secure: wGlok1fuT5CdmQFt2C9oyym18YfLZ7Xc3DRVnYd+uMCZ6gSPZzkpNVWEw0UmNT299OZXG7QOryTnkG958OGGaYWu4LU5GSpBPyzCWdUXPngXB9sHhXdEt74mUNGVA5HcOUlK3cv50TVhnMzzZqSXGh3xrFZHTD0KI9u9Nu5by00Io/33qffzN2B0HSCJ7Rhot+x1HTZA31CvCZ1mDSo4WgngCpDlpyKISf66h8TXwgBDBQK89pMtt9+NQghKiveduHBTR0Lmw8a+yRq0gnuOX7br44awHR4ZWnRsveJJPwNJykBkMAXH1BRgJCqcjPls3qM4rgKApAwUAnii73+9qqQdzv/0PNBWUavQe1/WJIrH77S4239dbsOTHKRTIWEK57SRJ5IZOVZFXG8efLKUQbBXYq4O9OqecrOFwmRoPyBNUKK777R4iex7yO5ezk8IOG2KCdkqc0IV/GI64U4b7DgSu2c8cXtdr8HyZLwP1OEcP2kUsB9CdkLFxTBBoVOT8aDsyqyPte8mHKsE/3qm+06tKh9f31NXITRyOVF5eKmPoJGW/KPteY4+nI0nohI38Q6VRDywN4sRt24IRgrU0C0QFDtjp7GSTN8QULK0gq3oVIqW8NAK9fCIuoYBTiFzJE6PENlxG7wPsL7Ng2mFFsgTVCy5ghOkI9ju7G2rcb4=

app/build.gradle

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ apply plugin: 'kotlin-kapt'
66
apply from: '../versioning.gradle'
77

88
ext {
9-
VERSION_NAME = "4.3.0"
9+
VERSION_NAME = "4.4.0"
10+
USE_ORCHESTRATOR = project.hasProperty('orchestrator') ? project.property('orchestrator') : false
1011
}
1112

1213
android {
1314
compileSdkVersion 27
14-
buildToolsVersion "26.0.2"
1515
defaultConfig {
1616
applicationId "com.duckduckgo.mobile.android"
1717
minSdkVersion 21
1818
targetSdkVersion 27
1919
versionCode buildVersionCode()
2020
versionName VERSION_NAME
21-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
21+
testInstrumentationRunner "com.duckduckgo.app.TestRunner"
2222
archivesBaseName = "duckduckgo-$versionName"
2323

2424
javaCompileOptions {
@@ -50,6 +50,10 @@ android {
5050
}
5151
testOptions {
5252
unitTests.returnDefaultValues = true
53+
54+
if(USE_ORCHESTRATOR) {
55+
execution 'ANDROID_TEST_ORCHESTRATOR'
56+
}
5357
}
5458

5559
def staticConfigPath = "${System.getenv('HOME')}/jenkins_static/com.duckduckgo.mobile.android"
@@ -79,21 +83,21 @@ ext {
7983

8084

8185
dependencies {
82-
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
83-
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
86+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
87+
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
8488

8589
implementation fileTree(dir: 'libs', include: ['*.jar'])
8690
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
8791
implementation "com.android.support:appcompat-v7:$supportLibrary"
8892
implementation "com.android.support:design:$supportLibrary"
8993
implementation "com.android.support.constraint:constraint-layout:1.0.2"
90-
implementation "com.squareup.okhttp3:okhttp:3.9.1"
94+
implementation "com.squareup.okhttp3:okhttp:3.10.0"
9195
implementation "com.squareup.retrofit2:retrofit:$retrofit"
9296
implementation "com.squareup.retrofit2:converter-moshi:$retrofit"
9397
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit"
94-
implementation "io.reactivex.rxjava2:rxjava:2.1.8"
95-
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
96-
implementation "com.jakewharton.timber:timber:4.6.0"
98+
implementation "io.reactivex.rxjava2:rxjava:2.1.10"
99+
implementation "io.reactivex.rxjava2:rxandroid:2.0.2"
100+
implementation "com.jakewharton.timber:timber:4.6.1"
97101
implementation "com.google.dagger:dagger-android:$dagger"
98102
implementation "com.google.dagger:dagger-android-support:$dagger"
99103
releaseImplementation 'com.faendir:acra:4.10.0'
@@ -120,14 +124,17 @@ dependencies {
120124
// Dagger
121125
kapt "com.google.dagger:dagger-android-processor:$dagger"
122126
kapt "com.google.dagger:dagger-compiler:$dagger"
127+
kaptAndroidTest "com.google.dagger:dagger-android-processor:$dagger"
128+
kaptAndroidTest "com.google.dagger:dagger-compiler:$dagger"
123129

124-
testImplementation "org.mockito:mockito-core:2.13.0"
130+
testImplementation "org.mockito:mockito-core:2.15.0"
125131
testImplementation "com.nhaarman:mockito-kotlin-kt1.1:1.5.0"
126132
testImplementation "junit:junit:4.12"
127133

128134
androidTestImplementation "com.android.support.test:runner:1.0.1"
135+
androidTestUtil "com.android.support.test:orchestrator:1.0.1"
129136
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.1"
130-
androidTestImplementation "org.mockito:mockito-android:2.13.0"
137+
androidTestImplementation "org.mockito:mockito-android:2.15.0"
131138
androidTestImplementation "com.nhaarman:mockito-kotlin-kt1.1:1.5.0"
132139

133140
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2018 DuckDuckGo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duckduckgo.app
18+
19+
object FileUtilities {
20+
21+
fun loadText(resourceName: String): String =
22+
javaClass.classLoader.getResource(resourceName).openStream().bufferedReader().use { it.readText() }
23+
24+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2018 DuckDuckGo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duckduckgo.app
18+
19+
20+
import io.reactivex.android.plugins.RxAndroidPlugins
21+
import io.reactivex.plugins.RxJavaPlugins
22+
import io.reactivex.schedulers.Schedulers
23+
import org.junit.rules.TestRule
24+
import org.junit.runner.Description
25+
import org.junit.runners.model.Statement
26+
27+
28+
class InstantSchedulersRule : TestRule {
29+
30+
override fun apply(base: Statement, description: Description): Statement {
31+
32+
return object : Statement() {
33+
34+
@Throws(Throwable::class)
35+
override fun evaluate() {
36+
37+
RxJavaPlugins.reset()
38+
RxAndroidPlugins.reset()
39+
40+
RxJavaPlugins.setIoSchedulerHandler { Schedulers.trampoline() }
41+
RxJavaPlugins.setComputationSchedulerHandler { Schedulers.trampoline() }
42+
RxJavaPlugins.setNewThreadSchedulerHandler { Schedulers.trampoline() }
43+
RxAndroidPlugins.setMainThreadSchedulerHandler { Schedulers.trampoline() }
44+
45+
base.evaluate()
46+
47+
RxJavaPlugins.reset()
48+
RxAndroidPlugins.reset()
49+
50+
}
51+
52+
}
53+
}
54+
55+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2018 DuckDuckGo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duckduckgo.app
18+
19+
import com.duckduckgo.app.di.DaggerTestAppComponent
20+
import com.duckduckgo.app.global.DuckDuckGoApplication
21+
22+
23+
class TestApplication : DuckDuckGoApplication() {
24+
25+
/**
26+
* Use TestAppComponents for android tests which lets us provide alternative test modules
27+
*
28+
* See [com.duckduckgo.app.di.TestAppComponent]
29+
*/
30+
31+
override fun configureDependencyInjection() {
32+
DaggerTestAppComponent.builder()
33+
.application(this)
34+
.create(this)
35+
.inject(this)
36+
}
37+
38+
// We don't need to actually use leak canary for tests
39+
override fun installLeakCanary(): Boolean = true
40+
41+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2018 DuckDuckGo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duckduckgo.app
18+
19+
import android.app.Application
20+
import android.content.Context
21+
import android.support.test.runner.AndroidJUnitRunner
22+
23+
24+
class TestRunner : AndroidJUnitRunner() {
25+
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
26+
return super.newApplication(cl, TestApplication::class.java.name, context)
27+
}
28+
}

app/src/androidTest/java/com/duckduckgo/app/bookmarks/db/BookmarksDaoTest.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,30 @@
1616

1717
package com.duckduckgo.app.bookmarks.db
1818

19+
import android.arch.core.executor.testing.InstantTaskExecutorRule
1920
import android.arch.persistence.room.Room
2021
import android.support.test.InstrumentationRegistry
2122
import com.duckduckgo.app.blockingObserve
2223
import com.duckduckgo.app.global.db.AppDatabase
2324
import org.junit.After
2425
import org.junit.Assert.*
2526
import org.junit.Before
27+
import org.junit.Rule
2628
import org.junit.Test
2729

2830
class BookmarksDaoTest {
2931

32+
@get:Rule
33+
@Suppress("unused")
34+
var instantTaskExecutorRule = InstantTaskExecutorRule()
35+
3036
private lateinit var db: AppDatabase
3137
private lateinit var dao: BookmarksDao
3238

3339
@Before
3440
fun before() {
3541
db = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(), AppDatabase::class.java)
42+
.allowMainThreadQueries()
3643
.build()
3744
dao = db.bookmarksDao()
3845
}

0 commit comments

Comments
 (0)