Skip to content

Commit

Permalink
[Security Settings] Add tests for collapsing enhanced protection
Browse files Browse the repository at this point in the history
The security settings page now supports collapsing the enhanced
protection radio button when the 'enableEsbCollapse' feature is enabled.
This change adds tests for that functionality.

Bug: 1422719
Change-Id: Ia89443c8b65cdca8102adebb2c659995186a2971
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4322066
Commit-Queue: Javier Castro <jacastro@chromium.org>
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1114811}
  • Loading branch information
Javier Castro authored and Chromium LUCI CQ committed Mar 8, 2023
1 parent b458457 commit e611ef6
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions chrome/test/data/webui/settings/security_page_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,19 +685,40 @@ suite('SecurityPage_SafeBrowsing', function() {
'recordSafeBrowsingInteractionHistogram'));
});

test('enhancedProtectionAutoExpanded', function() {
test('standardProtectionExpandedIfNoQueryParam', function() {
// Standard protection should be pre-expanded if there is no param.
Router.getInstance().navigateTo(routes.SECURITY);
assertEquals(
page.prefs.generated.safe_browsing.value, SafeBrowsingSetting.STANDARD);
assertFalse(page.$.safeBrowsingEnhanced.expanded);
assertTrue(page.$.safeBrowsingStandard.expanded);
});

test('enhancedProtectionExpandedIfEsbCollapseDisabled', function() {
// Enhanced protection should be pre-expanded if the param is set to
// enhanced.
// enhanced and enableEsbCollapse is false.
loadTimeData.overrideValues({enableEsbCollapse: false});
Router.getInstance().navigateTo(
routes.SECURITY,
/* dynamicParams= */ new URLSearchParams('q=enhanced'));
assertEquals(
SafeBrowsingSetting.STANDARD, page.prefs.generated.safe_browsing.value);
page.prefs.generated.safe_browsing.value, SafeBrowsingSetting.STANDARD);
assertTrue(page.$.safeBrowsingEnhanced.expanded);
assertFalse(page.$.safeBrowsingStandard.expanded);
});

test('enhancedProtectionCollapsedIfEsbCollapseEnabled', function() {
// Enhanced protection should be collapsed if the param is set to
// enhanced and enableEsbCollapse is true.
loadTimeData.overrideValues({enableEsbCollapse: true});

Router.getInstance().navigateTo(
routes.SECURITY,
/* dynamicParams= */ new URLSearchParams('q=enhanced'));
assertEquals(
page.prefs.generated.safe_browsing.value, SafeBrowsingSetting.STANDARD);
assertFalse(page.$.safeBrowsingEnhanced.expanded);
assertFalse(page.$.safeBrowsingStandard.expanded);
});

});

0 comments on commit e611ef6

Please sign in to comment.