Commit 95d24127 authored by Xinghui Lu's avatar Xinghui Lu Committed by Commit Bot

Auto expand enhanced protection section when the parameter is set.

Bug: 1130728
Change-Id: I9549b464abedb6e06b706a2923ccf613a99f02ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434884Reviewed-by: default avatarTheodore Olsauskas-Warren <sauski@google.com>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814298}
parent 58aa8ff4
...@@ -164,6 +164,12 @@ Polymer({ ...@@ -164,6 +164,12 @@ Polymer({
if (route === routes.SECURITY) { if (route === routes.SECURITY) {
this.metricsBrowserProxy_.recordSafeBrowsingInteractionHistogram( this.metricsBrowserProxy_.recordSafeBrowsingInteractionHistogram(
SafeBrowsingInteractions.SAFE_BROWSING_SHOWED); SafeBrowsingInteractions.SAFE_BROWSING_SHOWED);
const queryParams = Router.getInstance().getQueryParameters();
const section = queryParams.get('q');
if (section === 'enhanced') {
this.$.safeBrowsingEnhanced.expanded = true;
this.$.safeBrowsingStandard.expanded = false;
}
} }
}, },
......
...@@ -546,6 +546,22 @@ suite('CrSettingsSecurityPageTest', function() { ...@@ -546,6 +546,22 @@ suite('CrSettingsSecurityPageTest', function() {
await testMetricsBrowserProxy.whenCalled( await testMetricsBrowserProxy.whenCalled(
'recordSafeBrowsingInteractionHistogram')); 'recordSafeBrowsingInteractionHistogram'));
}); });
test('enhancedProtectionAutoExpanded', function() {
// Standard protection should be pre-expanded if there is no param.
Router.getInstance().navigateTo(routes.SECURITY);
assertFalse(page.$$('#safeBrowsingEnhanced').expanded);
assertTrue(page.$$('#safeBrowsingStandard').expanded);
// Enhanced protection should be pre-expanded if the param is set to
// enhanced.
Router.getInstance().navigateTo(
routes.SECURITY,
/* dynamicParams= */ new URLSearchParams('q=enhanced'));
assertEquals(
SafeBrowsingSetting.STANDARD, page.prefs.generated.safe_browsing.value);
assertTrue(page.$$('#safeBrowsingEnhanced').expanded);
assertFalse(page.$$('#safeBrowsingStandard').expanded);
});
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment