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

correct 1p cosmetic filtering test to correctly handle ports #7779

Closed
wants to merge 1 commit into from

Conversation

pes10k
Copy link
Contributor

@pes10k pes10k commented Feb 2, 2021

This PR fixes the test, which previously wanted to treat the testing origin (b.com:) as 1p to the sub resource (which was b.com). This PR corrects the test to make sure the sub resource is 1p (by making it a relative resource)

Resolves brave/brave-browser#13882

Submitter Checklist:

  • There is a ticket for my issue.
  • Used Github auto-closing keywords in the commit message.
  • Wrote a good PR/commit description
  • 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).
  • Requested a security/privacy review as needed.

Reviewer Checklist:

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

@simonhong
Copy link
Member

simonhong commented Feb 2, 2021

Maybe this is not related with this PR but found while testing AdBlockServiceTest.CosmeticFilteringProtect1p on local.
When I run this test case w/o calling UpdateAdBlockInstanceWithRules("b.com##.fpsponsored\n");,
it still get success on macOS.(not release build).
I'm not sure but test should be failed w/o this rule because fpsponsored is 1p.
Curious my assumption is right or not :)

Copy link
Collaborator

@antonok-edm antonok-edm left a comment

Choose a reason for hiding this comment

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

Sorry about this 😅

@antonok-edm antonok-edm self-requested a review February 2, 2021 17:41
Copy link
Collaborator

@antonok-edm antonok-edm left a comment

Choose a reason for hiding this comment

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

actually hang on, according to CI this is still a Windows-only failure for some reason...

@antonok-edm
Copy link
Collaborator

@simonhong

When I run this test case w/o calling UpdateAdBlockInstanceWithRules("b.com##.fpsponsored\n");,
it still get success on macOS.(not release build).
I'm not sure but test should be failed w/o this rule because fpsponsored is 1p.

The test here is to verify that the .fpsponsored element is still visible because of our first-party content protection rules, even though there is a matching rule in the adblock engine. So it makes sense that that would still pass.

@pes10k pes10k closed this Feb 3, 2021
@antonok-edm antonok-edm deleted the correct-cosmetic-test-to-account-for-ports branch February 4, 2021 17:04
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.

AdBlockServiceTest.CosmeticFilteringProtect1p is failed on Windows CI
3 participants