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

Add bubble for enabling cookie consent blocking #14148

Merged
merged 1 commit into from
Aug 5, 2022

Conversation

zenparsing
Copy link
Collaborator

@zenparsing zenparsing commented Jul 12, 2022

Resolves brave/brave-browser#10433

Overview:

  • A new WebUI bubble app has been added at components/brave_shields/resources/cookie_list_opt_in, along with supporting Mojo types and UI classes.
  • A new BrowserUserData helper has been added that is responsible for:
    • Owning the WebUIBubbleManager for the bubble.
    • Showing the bubble.
    • Determining when to show the bubble.
  • A new flag has been added to enable the bubble. ("Show an opt-in bubble for the 'Easylist-Cookie List' filter")

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested 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:

New profiles

  • Start browser with a new profile.
  • Enable the flag "Show an opt-in bubble for the 'Easylist-Cookie List' filter"
  • Restart the browser.
  • Wait for first page load.
  • Verify that the "cookie list opt-in" bubble is displayed.
  • Click the "enable" button.
  • Verify that the bubble is closed after the animation completes.
  • Navigate to brave://adblock.
  • Expand the list of filters, and verify that the "Cookie List" filter has been enabled.
  • Visit another page and verify that the opt-in bubble is not displayed again.
  • Restart the browser and verify that the opt-in bubble is not displayed again.

Clicking the X

  • Start browser with a new profile.
  • Enable the flag "Show an opt-in bubble for the 'Easylist-Cookie List' filter"
  • Restart the browser.
  • Wait for first page load.
  • Click the "X" button to close the bubble.
  • Visit another page and verify that the opt-in bubble is not displayed again.
  • Restart the browser and verify that the opt-in bubble is not displayed again.

Closing the bubble

  • Start browser with a new profile.
  • Enable the flag "Show an opt-in bubble for the 'Easylist-Cookie List' filter"
  • Restart the browser.
  • Wait for first page load.
  • Click outside of the bubble to close the bubble.
  • Visit another page and verify that the opt-in bubble is not displayed again.
  • Restart the browser and verify that the opt-in bubble is not displayed again.

@github-actions github-actions bot added CI/storybook-url Deploy storybook and provide a unique URL for each build potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false labels Jul 12, 2022
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@zenparsing zenparsing changed the title [WIP] Add popup for enabling cookie consent blocking Add popup for enabling cookie consent blocking Jul 12, 2022
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@zenparsing zenparsing changed the title Add popup for enabling cookie consent blocking [WIP] Add bubble for enabling cookie consent blocking Jul 15, 2022
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@zenparsing zenparsing changed the title [WIP] Add bubble for enabling cookie consent blocking Add bubble for enabling cookie consent blocking Jul 19, 2022
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

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.

Reviewed changes specifically under components/brave_shields/browser. Those changes look good to me 👍

(leaving the reviewer checklist boxes for the next reviewer since I haven't covered the entire PR)

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@zenparsing zenparsing requested a review from bridiver July 29, 2022 16:26
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

});

// Only one browser window should be showing the bubble on restore.
EXPECT_EQ(count, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

also check that it's the active window/tab?

Copy link
Collaborator

Choose a reason for hiding this comment

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

and also check that there are 2 windows. Is there any potential race here? Do we need to wait for session restore to finish before checking?

Copy link
Collaborator Author

@zenparsing zenparsing Aug 4, 2022

Choose a reason for hiding this comment

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

Added a check for 2 windows and added a restore wait. Since all browser windows are reported as inactive in browser tests (on MacOS anyway), and I can't find a way to force activation before the tab is loaded, there's no good way to test the active requirement that I'm currently aware of.

};

IN_PROC_BROWSER_TEST_F(CookieListOptInFirstRunBrowserTest, FirstRun) {
EXPECT_FALSE(GetBubbleWebContents());
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we also wait for session restore, ensure the active tab has finished loading and kAdBlockCookieListOptInShown is false?

Copy link
Collaborator Author

@zenparsing zenparsing Aug 4, 2022

Choose a reason for hiding this comment

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

Updated to wait for restore and added check for kAdBlockCookieListOptInShown. Browser tests automatically wait for the first tab to finish loading (see here).

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build potential-layer-violation-fixes This PR touches a BUILD.gn file with check_includes=false
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dialog to surface the setting for blocking cookie consent banners
5 participants