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

[ads] Send page land immediately for non-successful HTTP status codes #26404

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tmancey
Copy link
Collaborator

@tmancey tmancey commented Nov 6, 2024

Resolves brave/brave-browser#42137

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 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:

For pages returning HTTP status codes in the 4xx and 5xx ranges, redeem a landed confirmation token for Rewards users immediately without a 5-second delay. For status codes in the 2xx and 3xx ranges, apply a 5-second delay before redeeming the confirmation token.

@tmancey tmancey self-assigned this Nov 6, 2024
@tmancey tmancey requested a review from a team as a code owner November 6, 2024 19:33
@tmancey tmancey force-pushed the issues/42137 branch 2 times, most recently from 17b2af8 to 6ba8a78 Compare November 6, 2024 19:36
Copy link
Collaborator

@aseren aseren left a comment

Choose a reason for hiding this comment

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

LGTM

@tmancey tmancey force-pushed the issues/42137 branch 5 times, most recently from c8d421e to 4c6d6e1 Compare November 6, 2024 23:24
Copy link
Contributor

github-actions bot commented Nov 7, 2024

[puLL-Merge] - brave/brave-core@26404

Description

This PR makes changes to the Brave Ads component, primarily focusing on improving the handling of HTTP status codes in site visit tracking and ad serving. It also includes some refactoring and test improvements.

Changes

Changes

  1. components/brave_ads/core/internal/ad_units/creative_ad_cache_unittest.cc

    • Added net::HTTP_OK parameter to SimulateOpeningNewTab calls
  2. components/brave_ads/core/internal/ad_units/inline_content_ad/inline_content_ad_test.cc

    • Added net::HTTP_OK parameter to SimulateOpeningNewTab call
  3. components/brave_ads/core/internal/ads_client/ads_client_notifier_for_testing.cc and .h

    • Added http_status_code parameter to SimulateOpeningNewTab and SimulateNavigateToURL methods
  4. components/brave_ads/core/internal/common/net/http/http_status_code_util.cc and .h

    • Added IsSuccessfulHttpStatusCode function
    • Updated HttpStatusCodeToString function
  5. components/brave_ads/core/internal/common/net/http/http_status_code_util_unittest.cc

    • Added tests for IsSuccessfulHttpStatusCode
    • Updated existing tests
  6. components/brave_ads/core/internal/user_engagement/site_visit/site_visit.cc

    • Updated MaybeLandOnPage to handle HTTP status codes differently
    • Refactored logic for landing on pages
  7. components/brave_ads/core/internal/user_engagement/site_visit/site_visit_unittest.cc

    • Updated tests to include HTTP status codes
    • Added new tests for different HTTP status code scenarios
  8. components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util.cc and .h

    • Added ShouldResumePageLand function
  9. components/brave_ads/core/internal/user_engagement/site_visit/site_visit_util_unittest.cc

    • Added tests for ShouldResumePageLand
    • Updated existing tests to include HTTP status codes

Possible Issues

None identified.

Security Hotspots

None identified.

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

Successfully merging this pull request may close these issues.

[ads] Send page land immediately for non-successful HTTP status codes
2 participants