Skip to content

Commit 3b51b3b

Browse files
committed
Merge branch 'release/5.18.0'
2 parents f60720a + aa0aaab commit 3b51b3b

37 files changed

+341
-1147
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#These people are listed as being the code owners for this project. As such, they will be automatically added as a reviewer when a PR is created.
2+
#For more details on how this is configured, see https://help.github.com/articles/about-code-owners/
3+
4+
* @CDRussell @subsymbolic @brindy

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ captures/
4343
*.jks
4444

4545
# Fastlane
46-
fastlane/report.xml
46+
fastlane/report.xml
47+
48+
# Bitrise configuration
49+
bitrise.yml

app/build.gradle

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,22 @@ android {
7777
}
7878

7979
ext {
80-
androidX = "1.0.1"
81-
materialDesign = "1.1.0-alpha01"
80+
androidX = "1.0.2"
81+
materialDesign = "1.1.0-alpha02"
8282
architectureComponents = "1.1.1"
8383
architectureComponentsExtensions = "1.1.1"
8484
androidKtx = "1.0.1"
85-
androidTestRunner = "1.0.2"
86-
constraintLayout = "2.0.0-alpha2"
85+
constraintLayout = "2.0.0-alpha3"
8786
lifecycle = "2.0.0"
88-
room = "2.1.0-alpha02"
89-
workManager = "1.0.0-alpha11"
87+
room = "2.1.0-alpha04"
88+
workManager = "1.0.0-beta03"
89+
legacySupport = "1.0.0"
90+
espressoCore = "3.1.1"
91+
coreTesting = "2.0.0"
92+
androidTestRunner = "1.0.2"
93+
testRunner = "1.1.1"
9094

95+
junit = "4.12"
9196
dagger = "2.18"
9297
retrofit = "2.3.0"
9398
ankoVersion = "0.10.4"
@@ -101,11 +106,12 @@ ext {
101106
leakCanary = "1.6.2"
102107
mockito = "2.18.3"
103108
mockitoKotlin = "2.0.0"
109+
commonsMath = "3.6.1"
104110
}
105111

106112

107113
dependencies {
108-
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
114+
implementation "androidx.legacy:legacy-support-v4:$legacySupport"
109115
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanary"
110116
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanary"
111117

@@ -137,8 +143,8 @@ dependencies {
137143
// ViewModel and LiveData
138144
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle"
139145
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle"
140-
testImplementation "androidx.arch.core:core-testing:$lifecycle"
141-
androidTestImplementation "androidx.arch.core:core-testing:$lifecycle"
146+
testImplementation "androidx.arch.core:core-testing:$coreTesting"
147+
androidTestImplementation "androidx.arch.core:core-testing:$coreTesting"
142148

143149
// Room
144150
implementation "androidx.room:room-runtime:$room"
@@ -163,16 +169,16 @@ dependencies {
163169
implementation "com.airbnb.android:lottie:$lottieVersion"
164170

165171
// Apache commons
166-
implementation "org.apache.commons:commons-math3:3.6.1"
172+
implementation "org.apache.commons:commons-math3:$commonsMath"
167173

168174
testImplementation "org.mockito:mockito-core:$mockito"
169175
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlin"
170-
testImplementation "junit:junit:4.12"
176+
testImplementation "junit:junit:$junit"
171177

172-
androidTestImplementation 'androidx.test:runner:1.1.0'
173-
androidTestImplementation 'androidx.test:rules:1.1.0'
174-
androidTestUtil "androidx.test:orchestrator:1.1.0"
175-
androidTestImplementation "androidx.test.espresso:espresso-core:3.1.0"
178+
androidTestImplementation "androidx.test:runner:$testRunner"
179+
androidTestImplementation "androidx.test:rules:$testRunner"
180+
androidTestUtil "androidx.test:orchestrator:$testRunner"
181+
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoCore"
176182
androidTestImplementation "org.mockito:mockito-android:$mockito"
177183
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$okHttp"
178184
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlin"

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

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@ class BrowserTabViewModelTest {
365365

366366
@Test
367367
fun whenViewModelNotifiedThatUrlGotFocusThenViewStateIsUpdated() {
368-
testee.onOmnibarInputStateChanged("", true)
368+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
369369
assertTrue(omnibarViewState().isEditing)
370370
}
371371

372372
@Test
373373
fun whenViewModelNotifiedThatUrlLostFocusThenViewStateIsUpdated() {
374-
testee.onOmnibarInputStateChanged("", false)
374+
testee.onOmnibarInputStateChanged("", false, hasQueryChanged = false)
375375
assertFalse(omnibarViewState().isEditing)
376376
}
377377

@@ -468,27 +468,27 @@ class BrowserTabViewModelTest {
468468
fun whenOmnibarInputDoesNotHaveFocusAndAppConfigDownloadedAndBrowserShownThenPrivacyGradeIsShown() {
469469
testee.onUserSubmittedQuery("foo")
470470
testee.appConfigurationObserver.onChanged(AppConfigurationEntity(appConfigurationDownloaded = true))
471-
testee.onOmnibarInputStateChanged(query = "", hasFocus = false)
471+
testee.onOmnibarInputStateChanged(query = "", hasFocus = false, hasQueryChanged = false)
472472
assertTrue(browserViewState().showPrivacyGrade)
473473
}
474474

475475
@Test
476476
fun whenOmnibarInputDoesNotHaveFocusAndAppConfigDownloadedButBrowserNotShownThenPrivacyGradeIsHidden() {
477477
testee.appConfigurationObserver.onChanged(AppConfigurationEntity(appConfigurationDownloaded = true))
478-
testee.onOmnibarInputStateChanged(query = "", hasFocus = false)
478+
testee.onOmnibarInputStateChanged(query = "", hasFocus = false, hasQueryChanged = false)
479479
assertFalse(browserViewState().showPrivacyGrade)
480480
}
481481

482482
@Test
483483
fun whenOmnibarInputDoesNotHaveFocusAndAppConfigNotDownloadedThenPrivacyGradeIsNotShown() {
484484
testee.appConfigurationObserver.onChanged(AppConfigurationEntity(appConfigurationDownloaded = false))
485-
testee.onOmnibarInputStateChanged("", false)
485+
testee.onOmnibarInputStateChanged("", false, hasQueryChanged = false)
486486
assertFalse(browserViewState().showPrivacyGrade)
487487
}
488488

489489
@Test
490490
fun whenOmnibarInputHasFocusThenPrivacyGradeIsNotShown() {
491-
testee.onOmnibarInputStateChanged("", true)
491+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
492492
assertFalse(browserViewState().showPrivacyGrade)
493493
}
494494

@@ -499,25 +499,25 @@ class BrowserTabViewModelTest {
499499

500500
@Test
501501
fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenFireButtonIsShown() {
502-
testee.onOmnibarInputStateChanged("query", false)
502+
testee.onOmnibarInputStateChanged("query", false, hasQueryChanged = false)
503503
assertTrue(browserViewState().showFireButton)
504504
}
505505

506506
@Test
507507
fun whenOmnibarInputDoesNotHaveFocusOrQueryThenFireButtonIsShown() {
508-
testee.onOmnibarInputStateChanged("", false)
508+
testee.onOmnibarInputStateChanged("", false, hasQueryChanged = false)
509509
assertTrue(browserViewState().showFireButton)
510510
}
511511

512512
@Test
513513
fun whenOmnibarInputHasFocusAndNoQueryThenFireButtonIsShown() {
514-
testee.onOmnibarInputStateChanged("", true)
514+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
515515
assertTrue(browserViewState().showFireButton)
516516
}
517517

518518
@Test
519519
fun whenOmnibarInputHasFocusAndQueryThenFireButtonIsHidden() {
520-
testee.onOmnibarInputStateChanged("query", true)
520+
testee.onOmnibarInputStateChanged("query", true, hasQueryChanged = false)
521521
assertFalse(browserViewState().showFireButton)
522522
}
523523

@@ -528,25 +528,25 @@ class BrowserTabViewModelTest {
528528

529529
@Test
530530
fun whenOmnibarInputDoesNotHaveFocusOrQueryThenTabsButtonIsShown() {
531-
testee.onOmnibarInputStateChanged("", false)
531+
testee.onOmnibarInputStateChanged("", false, hasQueryChanged = false)
532532
assertTrue(browserViewState().showTabsButton)
533533
}
534534

535535
@Test
536536
fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenTabsButtonIsShown() {
537-
testee.onOmnibarInputStateChanged("query", false)
537+
testee.onOmnibarInputStateChanged("query", false, hasQueryChanged = false)
538538
assertTrue(browserViewState().showTabsButton)
539539
}
540540

541541
@Test
542542
fun whenOmnibarInputHasFocusAndNoQueryThenTabsButtonIsShown() {
543-
testee.onOmnibarInputStateChanged("", true)
543+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
544544
assertTrue(browserViewState().showTabsButton)
545545
}
546546

547547
@Test
548548
fun whenOmnibarInputHasFocusAndQueryThenTabsButtonIsHidden() {
549-
testee.onOmnibarInputStateChanged("query", true)
549+
testee.onOmnibarInputStateChanged("query", true, hasQueryChanged = false)
550550
assertFalse(browserViewState().showTabsButton)
551551
}
552552

@@ -557,53 +557,60 @@ class BrowserTabViewModelTest {
557557

558558
@Test
559559
fun whenOmnibarInputDoesNotHaveFocusOrQueryThenMenuButtonIsShown() {
560-
testee.onOmnibarInputStateChanged("", false)
560+
testee.onOmnibarInputStateChanged("", false, hasQueryChanged = false)
561561
assertTrue(browserViewState().showMenuButton)
562562
}
563563

564564
@Test
565565
fun whenOmnibarInputDoesNotHaveFocusAndHasQueryThenMenuButtonIsShown() {
566-
testee.onOmnibarInputStateChanged("query", false)
566+
testee.onOmnibarInputStateChanged("query", false, hasQueryChanged = false)
567567
assertTrue(browserViewState().showMenuButton)
568568
}
569569

570570
@Test
571571
fun whenOmnibarInputHasFocusAndNoQueryThenMenuButtonIsShown() {
572-
testee.onOmnibarInputStateChanged("", true)
572+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = false)
573573
assertTrue(browserViewState().showMenuButton)
574574
}
575575

576576
@Test
577577
fun whenOmnibarInputHasFocusAndQueryThenMenuButtonIsHidden() {
578-
testee.onOmnibarInputStateChanged("query", true)
578+
testee.onOmnibarInputStateChanged("query", true, hasQueryChanged = false)
579579
assertFalse(browserViewState().showMenuButton)
580580
}
581581

582582
@Test
583583
fun whenEnteringQueryWithAutoCompleteEnabledThenAutoCompleteSuggestionsShown() {
584584
doReturn(true).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
585-
testee.onOmnibarInputStateChanged("foo", true)
585+
testee.onOmnibarInputStateChanged("foo", true, hasQueryChanged = true)
586586
assertTrue(autoCompleteViewState().showSuggestions)
587587
}
588588

589+
@Test
590+
fun whenOmnibarInputStateChangedWithAutoCompleteEnabledButNoQueryChangeThenAutoCompleteSuggestionsNotShown() {
591+
doReturn(true).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
592+
testee.onOmnibarInputStateChanged("foo", true, hasQueryChanged = false)
593+
assertFalse(autoCompleteViewState().showSuggestions)
594+
}
595+
589596
@Test
590597
fun whenEnteringQueryWithAutoCompleteDisabledThenAutoCompleteSuggestionsNotShown() {
591598
doReturn(false).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
592-
testee.onOmnibarInputStateChanged("foo", true)
599+
testee.onOmnibarInputStateChanged("foo", true, hasQueryChanged = true)
593600
assertFalse(autoCompleteViewState().showSuggestions)
594601
}
595602

596603
@Test
597604
fun whenEnteringEmptyQueryWithAutoCompleteEnabledThenAutoCompleteSuggestionsNotShown() {
598605
doReturn(true).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
599-
testee.onOmnibarInputStateChanged("", true)
606+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = true)
600607
assertFalse(autoCompleteViewState().showSuggestions)
601608
}
602609

603610
@Test
604611
fun whenEnteringEmptyQueryWithAutoCompleteDisabledThenAutoCompleteSuggestionsNotShown() {
605612
doReturn(false).whenever(mockSettingsStore).autoCompleteSuggestionsEnabled
606-
testee.onOmnibarInputStateChanged("", true)
613+
testee.onOmnibarInputStateChanged("", true, hasQueryChanged = true)
607614
assertFalse(autoCompleteViewState().showSuggestions)
608615
}
609616

0 commit comments

Comments
 (0)