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

omnibox brave search promo banner android #14350

Merged
merged 6 commits into from
Aug 9, 2022

Conversation

tapanmodh
Copy link
Contributor

@tapanmodh tapanmodh commented Jul 27, 2022

Resolves brave/brave-browser#23062

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have [requested] https://github.com/brave/security/issues/878 one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  • When a user types in the url bar, we will place a Brave Search banner at the bottom of the omnibox.
  • When a user selects “Try Brave Search”, they will be taken to the Brave Search SERP with their intended query.
  • Pressing “Maybe later” on the banner will hide the banner for the current session. On the next session, the banner will appear again but “Maybe later” will be replaced with “Dismiss”. If a user selects Dismiss, the banner won’t be displayed again.
  • We will continue to show this banner until the user has made Brave Search their default search engine or 15 days
  • On the Brave Search SERP, if a user pressed “Set Brave Search as default” the Brave search engine should be set as default

@tapanmodh tapanmodh added CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-ios Do not run CI builds for iOS labels Jul 27, 2022
@tapanmodh tapanmodh added this to the 1.44.x - Nightly milestone Jul 27, 2022
@tapanmodh tapanmodh requested review from samartnik and a team as code owners July 27, 2022 07:21
@tapanmodh tapanmodh self-assigned this Jul 27, 2022
@tapanmodh tapanmodh requested a review from a team as a code owner July 27, 2022 14:43
@@ -20,6 +20,9 @@ public static ClassVisitor createAdapter(ClassVisitor chain) {
chain = new BraveCommandLineInitUtilClassAdapter(chain);
chain = new BraveContentSettingsResourcesClassAdapter(chain);
chain = new BraveCustomizationProviderDelegateImplClassAdapter(chain);
chain = new BraveDropdownItemViewInfoListManagerClassAdapter(chain);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make these in alphabetical order

parent.getContext(), R.layout.omnibox_basic_suggestion),
new PedalSuggestionViewBinder<View>(SuggestionViewViewBinder::bind));

adapter.registerType(BraveOmniboxSuggestionUiType.BRAVE_SEARCH_PROMO_BANNER,
Copy link
Contributor

Choose a reason for hiding this comment

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

Apart form this the rest seems to be the copy of the parent. Can we extend SuggestionListViewHolder and get there to the adapter and register type in BraveSuggestionListViewHolder?

@tapanmodh tapanmodh force-pushed the search_engine_default_promo_android branch 5 times, most recently from 8896658 to 68091b8 Compare August 3, 2022 20:52
@tapanmodh tapanmodh force-pushed the search_engine_default_promo_android branch from 68091b8 to 54c44d2 Compare August 4, 2022 08:05
@@ -373,6 +390,9 @@ public void testMethodsExist() throws Exception {
Assert.assertTrue(methodExists(
"org/chromium/chrome/browser/suggestions/tile/MostVisitedTilesMediator",
"updateTilePlaceholderVisibility", true, void.class));
Assert.assertTrue(methodExists(
"org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator",
"createViewProvider", false, null));
Copy link
Contributor

Choose a reason for hiding this comment

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

We should move this one to testMethodsForInvocationExist and make sure parameters are still the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will do it


private boolean isBraveSearchPromoBanner() {
Tab activeTab = mActivityTabSupplier.get();
if (ChromeFeatureList.isEnabled("BraveSearchOmniboxBanner")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should define feature name as constant instead of hardcoding.

@tapanmodh tapanmodh requested a review from a team as a code owner August 4, 2022 20:54
Copy link
Contributor

@samartnik samartnik left a comment

Choose a reason for hiding this comment

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

lgtm

@tapanmodh tapanmodh force-pushed the search_engine_default_promo_android branch 4 times, most recently from 6bf3746 to c9b77b0 Compare August 5, 2022 12:56
@tapanmodh tapanmodh force-pushed the search_engine_default_promo_android branch from c9b77b0 to ed85fae Compare August 5, 2022 13:36
Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

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

++

@@ -13,6 +13,7 @@ include_rules = [
"+brave/components/brave_shields",
"+brave/components/brave_sync",
"+brave/components/brave_today",
"+brave/components/brave_search_conversion",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Place in alphabetical order, please.

@@ -12,6 +13,7 @@
#define kForceWebContentsDarkMode kForceWebContentsDarkMode, \
&brave_rewards::features::kBraveRewards, \
&brave_today::features::kBraveNewsFeature, \
&brave_search_conversion::features::kOmniboxBanner, \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Alphabetical order here as well, please.

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

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

chromium_src & DEPS LGTM with a couple of formatting nits.

Copy link
Collaborator

@tmancey tmancey left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@deeppandya deeppandya left a comment

Choose a reason for hiding this comment

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

LGTM

@tapanmodh tapanmodh merged commit b71f6c6 into master Aug 9, 2022
@tapanmodh tapanmodh deleted the search_engine_default_promo_android branch August 9, 2022 04:53
deeppandya pushed a commit that referenced this pull request Aug 24, 2022
@kjozwiak
Copy link
Member

The new design that was discussed via Slack was verified by QA via #14778 (comment) 👍

@kjozwiak
Copy link
Member

kjozwiak commented Aug 30, 2022

Verification PASSED on Samsung S10+ running Android 12 using the following build(s):

Brave | 1.45.9 Chromium: 105.0.5195.68 (Official Build) canary (32-bit)
--- | ---
Revision | ad13e82529051bac6a0e65f455e6d7a1e5fd7938-refs/branch-heads/5195@{#903}
OS | Android 12; Build/SP1A.210812.016

Test Case #1 (Supported Regions - US/CA/DE/FR/UK/AT/ES/MX)

  • installed 1.45.9 Chromium: 105.0.5195.68
  • ensured that the system language is set to either US, CA, DE, FR, UK, AT, ES or MX
  • launched brave and changed the default SE from Brave to anything else within the list (Google, DDG, Startpage etc..)
  • added --enable-features=BraveSearchOmniboxBanner into Command Line String via QA Preferences
  • re-launched the browser tapped on the URL bar and ensured that the Brave search promo is displayed via the omnibox
  • ensured that the Brave search promo appears when tapping/editing a URL and the promo hasn't been closed/dismissed
  • ensured that the Brave search promo doesn't appear if Private is set to another SE but Standard is still selected as Brave
  • ensured that tapping on Maybe Later closes the promo within the omnibox and doesn't appear again within the session
    • ensured that it doesn't appear via the omnibox via NTP when starting to enter a URL/search term
    • ensured that tapping on a URL in an existing tab doesn't display the promo
  • ensured that tapping on Try Brave Search opens https://search.brave.com/search?q=motorsport&action=makeDefault
    • ensured that the search term is also appended as per search?q=motorsport
    • ensured that tapping on Try Brave Search adds action=makeDefault into the URL

Canada

Example Example Example Example Example Example Example
Screenshot_20220829-204621_Brave - Nightly Screenshot_20220829-204655_Brave - Nightly Screenshot_20220829-204709_Brave - Nightly Screenshot_20220829-204724_Brave - Nightly Screenshot_20220829-204757_Brave - Nightly Screenshot_20220829-204803_Brave - Nightly Screenshot_20220829-205138_Brave - Nightly

Mexico

Example Example Example Example Example Example Example
Screenshot_20220829-211940_Brave - Nightly Screenshot_20220829-212009_Brave - Nightly Screenshot_20220829-212023_Brave - Nightly Screenshot_20220829-212107_Brave - Nightly Screenshot_20220829-214051_Brave - Nightly Screenshot_20220829-214058_Brave - Nightly Screenshot_20220829-214147_Brave - Nightly

Test Case #2 (Regions that don't have Brave Search as default SE/Still use SE onboarding)

  • installed 1.45.9 Chromium: 105.0.5195.68
  • ensured that the system language is set to the correct locale (in this case, either Japan or Poland)
  • launched brave and added --enable-features=BraveSearchOmniboxBanner into Command Line String via QA Preferences
  • re-launched the browser tapped on the URL bar twice and ensured that the SE onboarding screen is displayed
  • ensured that Google was selected as the default via the onboarding screen
  • ensured that Google is default SE for both Standard & Private windows once the onboarding screen has been dismissed
  • ensured that the Brave search promo isn't appearing via the omnibox when a text/search term is entered

Japan

Example Example Example Example
Screenshot_20220829-170533_Brave - Nightly Screenshot_20220829-170545_Brave - Nightly Screenshot_20220829-170345_Brave - Nightly Screenshot_20220829-170408_Brave - Nightly

Poland

Example Example Example Example
Screenshot_20220829-171448_Brave - Nightly Screenshot_20220829-171502_Brave - Nightly Screenshot_20220829-202358_Brave - Nightly Screenshot_20220829-171510_Brave - Nightly

Test Case #3 (Maybe Later & Dismiss)

  • ensured that closing the Brave search promo via Maybe Later doesn't re-appear in the same session
    • ensure the promo is not re-appearing when typing into the omnibox via NTP
    • ensure the promo is not re-appearing when taping on a URL on an existing opened tab
  • ensured that the promo re-appears again when the browser is re-launched after tapping on Maybe Later
  • ensured that once a user taps/clicks on Dismiss, the promo never re-appears (tried via several re-launches)
Example Example Example Example
Screenshot_20220829-225327_Brave - Nightly Screenshot_20220829-225716_Brave - Nightly Screenshot_20220829-225641_Brave - Nightly Screenshot_20220829-225725_Brave - Nightly

Test Case #4 (Automatically dismiss after 15 days)

  • installed 1.45.9 Chromium: 105.0.5195.68
  • ensured that the system language is set to either US, CA, DE, FR, UK, AT, ES or MX
  • launched brave and changed the default SE from Brave to anything else within the list (Google, DDG, Startpage etc..)
  • added --enable-features=BraveSearchOmniboxBanner into Command Line String via QA Preferences
  • re-launched the browser tapped on the URL bar and ensured that the Brave search promo is displayed via the omnibox
  • moved the time/date on the device ahead ~16 days and re-launched the browser
  • ensured that the Brave search promo doesn't appear via the omnibox when tapping via NTP
  • ensured that the Brave search promo doesn't appear when tapping on the omnibox if an already opened tab

@kjozwiak
Copy link
Member

Also found brave/brave-browser#25059 while running through the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64
Projects
None yet
7 participants