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 De-AMP setting for Android, enable by default #13001

Merged
merged 2 commits into from
Apr 13, 2022

Conversation

ShivanKaul
Copy link
Collaborator

@ShivanKaul ShivanKaul commented Apr 12, 2022

Resolves brave/brave-browser#21643

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:

Comprehensive QA/test plan at #11750 (comment)

In addition to that, the test cases mentioned in #12923 (comment) should work on Android.

@ShivanKaul ShivanKaul self-assigned this Apr 12, 2022
base::FEATURE_ENABLED_BY_DEFAULT
#endif
};
const base::Feature kBraveDeAMP{"BraveDeAMP", base::FEATURE_ENABLED_BY_DEFAULT};
Copy link
Member

Choose a reason for hiding this comment

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

do we want it to be enabled by default? An original issue says that it will be controlled by Griffin.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the idea was to have it enabled by default, and there's a feature flag that we could use to turn it off via Griffin in case there are issues. Can you confirm @pes10k

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, exactly right @ShivanKaul

@SergeyZhukovsky
Copy link
Member

there is a failed java tests because of an added a new pref.

@ShivanKaul
Copy link
Collaborator Author

@SergeyZhukovsky incremented BRAVE_PRIVACY_SETTINGS_NUMBER_OF_ITEMS, I think that was the only failing test.

@ShivanKaul ShivanKaul added this to the 1.39.x - Nightly milestone Apr 13, 2022
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.

++

@ShivanKaul ShivanKaul merged commit e0ad15b into master Apr 13, 2022
@ShivanKaul ShivanKaul deleted the feature/de-amp/android-pref branch April 13, 2022 21:37
@ShivanKaul ShivanKaul restored the feature/de-amp/android-pref branch April 19, 2022 15:51
brave-builds pushed a commit that referenced this pull request Apr 19, 2022
@kjozwiak
Copy link
Member

kjozwiak commented Apr 22, 2022

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

Brave | 1.40.3 Chromium: 101.0.4951.41 (Official Build) canary (32-bit)
--- | ---
Revision | 93c720db8323b3ec10d056025ab95c23a31997c9-refs/branch-heads/4951@{#904}
OS | Android 12; Build/SP1A.210812.016

Used the STR/Cases outlined via #11750.

Test Case 1: Inspecting AMP elements on pages
  1. Disable Auto-redirect AMP pages in brave://settings/privacy
  2. Disable Enable De-AMP flag - brave://flags/#brave-de-amp
  3. Relaunch Brave
  4. Visit AMP page https://shivankaul.com/brave/de-amp/test-small-amp.html.
    • Inspected element and amp attribute will be shown in the top level <html amp> tag for the AMP page and has canonical link that redirects to html
  5. Close the tab and visit another AMP page https://shivankaul.com/brave/de-amp/test-small-amp-with-lightning.html
    • Inspected element and it contains lightning symbol in the top-level <html ⚡> tag for the AMP page and has canonical link that redirects to html
  6. Close the tab and visit https://shivankaul.com/brave/de-amp/test-no-canonical-link.html
    • Inspected element and it doesn't contain any canonical links or top-level tags
  7. Close the tab and visit https://shivankaul.com/brave/de-amp/test-wrong-scheme.html
    • Inspected element for canonical link that is non-HTTP(s) - <link rel="canonical" href="ipfs://QmcniBv7UQ4gGPQQW2BwbD4ZZHzN3o3tPuNLZCbBchd1zh">
  8. Close the tab and visit https://shivankaul.com/brave/de-amp/test-small-amp-same-canonical.html
    • Inspected the element and it has canonical link that is pointed to original/same URL
  9. Close the tab and visit https://www.buzzfeed.com/amphtml/ryanschocket2/snl-spoofs-will-smith-chris-rock-slap
    • Inspected the element and it has canonical link that is pointed https://www.buzzfeed.com/ryanschocket2/snl-spoofs-will-smith-chris-rock-slap
Example Example Example Example Example Example Example Example
Screenshot_20220421-193012_Brave - Nightly Screenshot_20220421-193220_Brave - Nightly image image image image image image
Test Case 2: Verifying AMP page will not be redirected when both de-AMP flag and auto-redirect AMP page are disabled
  1. Disable Auto-redirect AMP pages in brave://settings/privacy
  2. Disable #brave-de-amp flag in brave://flags/
  3. Relaunch the browser
  4. Visit https://shivankaul.com/brave/de-amp/test-small-amp.html
  5. Inspect the page and it showedamp as attribute
  6. Contains canonical in the tag
  7. AMP Page is not redirected to brave.com
Example Example Example
Screenshot_20220421-193012_Brave - Nightly Screenshot_20220421-193220_Brave - Nightly image

Prerequisites for the following test cases:

  1. Verified both brave://settings/privacy & Auto-redirect AMP pages are enabled by default
  2. Verified Enable De-AMP is enabled by default via brave://flags/#brave-de-amp
Test Case 3: Verifying de-AMPing works as expected i.e redirects to brave.com with default settings
  1. Visit https://shivankaul.com/brave/de-amp/test-small-amp.html
  2. De-AMPing worked i.e AMP page is redirected to brave.com, as it contained the markup for top-level <html amp>
  3. The markup was verified in Test Case 1 for the above AMP page and amp attribute will be shown in the top level <html amp> tag for the AMP page and has canonical link that redirects to html
Example Example Example Example
Screenshot_20220421-200121_Brave - Nightly Screenshot_20220421-200139_Brave - Nightly image image
Test Case 4: Verifying de-AMPing works if the AMP page contains the lightning emoji instead of "amp" as attribute
  1. Visit https://shivankaul.com/brave/de-amp/test-small-amp-with-lightning.html
  2. De-AMPing worked i.e AMP page is redirected to brave.com as it contained markup for top-level <html ⚡> tag
  3. The markup was verified in Testcase 1 for the above AMP page has lightning <html ⚡> tag and contains canonical in the tag for redirect
Example Example Example Example
Screenshot_20220421-200121_Brave - Nightly Screenshot_20220421-200139_Brave - Nightly image image
Test Case 5: Verifying de-AMPing will not work for AMP page with no canonical link
  1. Visit https://shivankaul.com/brave/de-amp/test-no-canonical-link.html
  2. De-AMPing did not work i.e AMP page is not redirected since there is no canonical link tag
  3. The markup was verified in Test Case 1, for the above AMP page has no canonical link tag hence no redirect available
Example Example Example
Screenshot_20220421-200121_Brave - Nightly Screenshot_20220421-200139_Brave - Nightly image
Test Case 6: Verifying de-AMPing will not work for AMP page that includes canonical link with scheme != HTTP(S)
  1. Visit https://shivankaul.com/brave/de-amp/test-wrong-scheme.html
  2. De-AMPing did not work i.e AMP page is not redirected since the AMP page has canonical link with scheme non HTTP(S)
  3. Verified in Test Case 1, Step 8, that the above AMP page has canonical link with scheme non HTTP(S)
Example Example Example
Screenshot_20220421-200121_Brave - Nightly Screenshot_20220421-200139_Brave - Nightly image
Test Case 7: Verifying de-AMPing will not work for AMP page with canonical link same as original URL
  1. Visit https://shivankaul.com/brave/de-amp/test-small-amp-same-canonical.html
  2. "De-AMPing did not work i.e AMP page is not redirected since the AMP page has canonical link same as original URL
  3. Verified in Test Case 1, Step 9, that the above AMP page has canonical link same as original URL
Example Example Example
Screenshot_20220421-200121_Brave - Nightly Screenshot_20220421-200139_Brave - Nightly image
Test Case 8: Verifying that navigating backward and forward ignores the AMP page in history
  1. Visited example.com
  2. Visited AMP page in the same tab- https://shivankaul.com/brave/de-amp/test-small-amp.html
  3. Page is redirected to brave.com
  4. Visited https://basicattentiontoken.org in the same tab
  5. clicked back in the browser
  6. Returned to brave.com
  7. Clicked back again
  8. AMP page https://shivankaul.com/brave/de-amp/test-small-amp.html is ignored and is not listed in history
  9. Clicked forward
  10. User is taken brave.com
  11. Clicked forward again
  12. Returned to https://basicattentiontoken.org
  13. AMP page https://shivankaul.com/brave/de-amp/test-small-amp.html is ignored and is not listed in history
  14. Verified the history lists example.com, brave.com, and basicattentiontoken.org
Example Example Example Example Example Example Example
image image image image image image Screenshot_20220421-214834_Brave - Nightly
Test Case 9: Verifying restore de-AMPed page
  1. Visit https://shivankaul.com/brave/de-amp/test-small-amp.html
  2. Page should be redirected to brave.com
  3. Opened a few tabs
  4. Close brave.com tab
  5. Restore the tab
  6. De-AMPed page loaded
Example (Before Restore) Example (After Restore)
image image
Test Case 10: Verfying de-AMPing works well with small pages < 64 K works expected
  1. Visit https://shivankaul.com/brave/de-amp/test-small-amp.html
  2. De-AMPing worked i.e AMP page is redirected to brave.com

image

Test Case 11: Verifying large AMP page (> 64K) works as expected
  1. Visit https://www.buzzfeed.com/amphtml/ryanschocket2/snl-spoofs-will-smith-chris-rock-slap
  2. De-AMP ing worked i.e AMP page is redirected to https://www.buzzfeed.com/ryanschocket2/snl-spoofs-will-smith-chris-rock-slap
  3. The markup was verified in Test Case 1 for the above AMP page has canonical link to https://www.buzzfeed.com/ryanschocket2/snl-spoofs-will-smith-chris-rock-slap

image

Test Case 12: Verifying de-AMPing will not work with Auto-redirect AMP pages ON and de-AMPing feature flag ON (default)
  1. Disable Auto-redirect AMP pagesinbrave://settings/privacy
  2. Keep Enable De-AMP flag as a default in brave://flags/#brave-de-amp
  3. Visit AMP page https://shivankaul.com/brave/de-amp/test-small-amp.html
  4. Page is not redirected to brave.com
Example Example Example
Screenshot_20220421-220015_Brave - Nightly Screenshot_20220421-220056_Brave - Nightly image
Test Case 13: Verifying de-AMPing will not work with Auto-redirect AMP pages ON and de-AMPing feature flag OFF
  1. EnableAuto-redirect AMP pagesinbrave://settings/privacy
  2. Disable Enable De-AMP flag in brave://flags/#brave-de-amp
  3. Visit AMP page https://shivankaul.com/brave/de-amp/test-small-amp.html
  4. Page is not redirected to brave.com
Example Example Example
Screenshot_20220421-220436_Brave - Nightly Screenshot_20220421-220445_Brave - Nightly image

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.

[De-AMP] Follow up issues for Android
4 participants