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

Fixed NTP shows same background images #19896

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Aug 28, 2023

fix brave/brave-browser#32359

Sometimes we could meet the condition that
ViewCounterModel::count_to_branded_wallpaper_ is zero and no SI campaign.
When this happens, we didn't increase background wallpaper index.
This caused showing same background image till new campaign starts.
We should increase background images index in this situation also.

Resolves

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • 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 wiki
    • npm run lint, npm run presubmit wiki, 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:

ViewCounterModelTest.NTPBackgroundImagesWithEmptyCampaignTest

Manual test.

  1. Launch browser and current region has SI campaign.
  2. Open NTP reload multiple times till SI is shown and reload three times.
    With this condition, NTP SI will be shown at next NTP reloading or opening
  3. Close all NTP to prevent opening NTP at next startup (Having non-NTP tab is fine before closing window)
  4. Shutdown browser and change to another region that doesn't have SI campaign
  5. Launch Browser and make sure there is no NTP tab
  6. Load brave://components and update NTP SI components to get empty campaign
  7. Open NTP and reload
  8. Check different NTP background images are shown whenever reloading

To test more easily, we could edit Preferences file manually instead of above step

  1. Launch browser and close all NTP to prevent NTP opening after next startup
  2. Shutdown browser
  3. Change to another region that doesn't have SI campaign
  4. Set zero to count_to_branded_wallpaper value in user dir's Preferences file
  5. Launch browser and make sure there is no NTP and update NTP SI campaigns from brave://components to get empty NTP SI
  6. Open NTP and reload
  7. Check different NTP background images are shown whenever reloading

fix brave/brave-browser#32359

Sometimes we could meet the condition that
ViewCounterModel::count_to_branded_wallpaper_ is zero and no SI campaign.
When this happens, we didn't increase background wallpaper index.
This caused showing same background image till new campaign starts.
We should increase background images index in this situation also.
@simonhong simonhong merged commit 13ab4d7 into master Aug 28, 2023
18 checks passed
@simonhong simonhong deleted the fixed_same_background_image_is_shown branch August 28, 2023 07:47
@github-actions github-actions bot added this to the 1.59.x - Nightly milestone Aug 28, 2023
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++

@kjozwiak
Copy link
Member

kjozwiak commented Sep 8, 2023

Verification PASSED on Win 11 x64 using the following build(s):

Brave | 1.60.3 Chromium: 117.0.5938.35 (Official Build) nightly (64-bit)
-- | --
Revision | 6f3491e9658c636314365097686bdbd636d39163
OS | Windows 11 Version 22H2 (Build 22621.2215)

Using the STR/Cases outlined via #19896 (comment), reproduced the original issue running 1.59.52 Chromium: 116.0.5845.114 as per the following:

  • installed/launched 1.59.52 Chromium: 116.0.5845.114
  • opened NTP/refreshed till a NTP SI appeared
  • refreshed the same NTP three more times and then opened brave://components within that NTP
    • ensuring that the next NTP that you open should display/present a NTP SI
  • closed Brave and changed both the Region & Language to Japan on my machine (needed to log off on Win)
    • Japan currently doesn't have any NTP SI campaigns running
  • connected to a Japan VPN via ProtonVPN
  • re-launched Brave and ensured that NTP Sponsored Images (JP) was displayed via brave://components
    • previously it was appearing as ``NTP Sponsored Images (CA)before changingRegions` & `Language`
  • opened a NTP and refreshed it several times (notice that it doesn't cycle through the images anymore)
-.Brave.2023-09-07.17-33-36.mp4

Clean Install

Using the exact same STR/Cases mentioned above, ensured that the original issue mentioned via brave/brave-browser#32359 (comment) wasn't occurring as per the following:

-.Brave.2023-09-07.17-49-11.mp4

Upgrade Case

Using the exact same STR/Cases mentioned above, reproduced the issue using 1.59.52 Chromium: 116.0.5845.114 and then updated to 1.60.3 Chromium: 117.0.5938.35 via brave://settings/help and ensured that the issue wasn't occurring anymore as per the following:

-.Brave.-.Brave.2023-09-07.17-34-53-Update.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NTP always shows the same background image
4 participants