2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

Merge pull request #3583 from mozilla-mobile/mergify/bp/releases_v118/pr-3528

Bug 1851006 - SearchEngineSuggestionProvider should always be added to the provider list. (backport #3528)
This commit is contained in:
Pascal Chevrel 2023-09-12 15:15:07 +02:00 committed by GitHub
commit 127646004d
2 changed files with 4 additions and 21 deletions

View File

@ -318,9 +318,7 @@ class AwesomeBarView(
providersToAdd.add(getLocalTabsProvider(state.searchEngineSource, true)) providersToAdd.add(getLocalTabsProvider(state.searchEngineSource, true))
} }
if (!activity.settings().showUnifiedSearchFeature) {
providersToAdd.add(searchEngineSuggestionProvider) providersToAdd.add(searchEngineSuggestionProvider)
}
return providersToAdd return providersToAdd
} }

View File

@ -765,7 +765,7 @@ class AwesomeBarViewTest {
} }
@Test @Test
fun `GIVEN unified search feature is enabled WHEN configuring providers THEN don't add the engine suggestions provider`() { fun `GIVEN a search is made by the user WHEN configuring providers THEN search engine suggestion provider should always be added`() {
val settings: Settings = mockk(relaxed = true) { val settings: Settings = mockk(relaxed = true) {
every { showUnifiedSearchFeature } returns true every { showUnifiedSearchFeature } returns true
} }
@ -776,21 +776,6 @@ class AwesomeBarViewTest {
val result = awesomeBarView.getProvidersToAdd(state) val result = awesomeBarView.getProvidersToAdd(state)
assertEquals(0, result.filterIsInstance<SearchEngineSuggestionProvider>().size)
}
@Test
fun `GIVEN unified search feature is disabled WHEN configuring providers THEN add the engine suggestions provider`() {
val settings: Settings = mockk(relaxed = true) {
every { showUnifiedSearchFeature } returns false
}
every { activity.settings() } returns settings
val state = getSearchProviderState(
searchEngineSource = SearchEngineSource.Default(mockk(relaxed = true)),
)
val result = awesomeBarView.getProvidersToAdd(state)
assertEquals(1, result.filterIsInstance<SearchEngineSuggestionProvider>().size) assertEquals(1, result.filterIsInstance<SearchEngineSuggestionProvider>().size)
} }
@ -834,7 +819,7 @@ class AwesomeBarViewTest {
} }
@Test @Test
fun `GIVEN a search from the default engine with no suggestions asked WHEN configuring providers THEN don't add any provider`() { fun `GIVEN a search from the default engine with no suggestions asked WHEN configuring providers THEN add only search engine suggestion provider`() {
val settings: Settings = mockk(relaxed = true) { val settings: Settings = mockk(relaxed = true) {
every { showUnifiedSearchFeature } returns true every { showUnifiedSearchFeature } returns true
} }
@ -862,7 +847,7 @@ class AwesomeBarViewTest {
assertEquals(0, result.filterIsInstance<SearchSuggestionProvider>().size) assertEquals(0, result.filterIsInstance<SearchSuggestionProvider>().size)
assertEquals(0, result.filterIsInstance<SyncedTabsStorageSuggestionProvider>().size) assertEquals(0, result.filterIsInstance<SyncedTabsStorageSuggestionProvider>().size)
assertEquals(0, result.filterIsInstance<SessionSuggestionProvider>().size) assertEquals(0, result.filterIsInstance<SessionSuggestionProvider>().size)
assertEquals(0, result.filterIsInstance<SearchEngineSuggestionProvider>().size) assertEquals(1, result.filterIsInstance<SearchEngineSuggestionProvider>().size)
} }
@Test @Test