Skip to content

Commit

Permalink
Hide redundant settings-secure-dns settings (uplift to 1.70.x) (#25572)
Browse files Browse the repository at this point in the history
Uplift of #25521 (squashed) to release
  • Loading branch information
brave-builds authored Sep 16, 2024
1 parent 4f3fc97 commit 34a49b4
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/chrome/browser/resources/settings/privacy_page/security_page.html b/chrome/browser/resources/settings/privacy_page/security_page.html
index 7d79e5cb222645e3d789db363e5375ed6c86f7f3..354af4a6a000a6309c421f870a24724055647ef4 100644
--- a/chrome/browser/resources/settings/privacy_page/security_page.html
+++ b/chrome/browser/resources/settings/privacy_page/security_page.html
@@ -272,15 +272,17 @@
numeric-checked-value="[[httpsFirstModeSettingEnum_.ENABLED_FULL]]">
</settings-toggle-button>
<template is="dom-if" if="[[showSecureDnsSetting_]]">
- <settings-secure-dns prefs="{{prefs}}"></settings-secure-dns>
+ <settings-secure-dns prefs="{{prefs}}" id="secureDnsSettingOld">
+ </settings-secure-dns>
</template>
</template>
- <tempate is="dom-if" if="[[enableHttpsFirstModeNewSettings_]]" restamp>
+ <template is="dom-if" if="[[enableHttpsFirstModeNewSettings_]]" restamp>
<template is="dom-if" if="[[showSecureDnsSetting_]]">
- <settings-secure-dns prefs="{{prefs}}" class="no-hr">
+ <settings-secure-dns prefs="{{prefs}}" class="no-hr"
+ id="secureDnsSettingNew">
</settings-secure-dns>
</template>
- </tempate>
+ </template>
<if expr="is_chromeos">
<template is="dom-if" if="[[showSecureDnsSettingLink_]]">
<cr-link-row id="openChromeOSSecureDnsSettings"
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/chrome/test/data/webui/settings/security_page_test.ts b/chrome/test/data/webui/settings/security_page_test.ts
index f14e2dd3bc1ef02adac14bf24688c7421d86e984..e644899a644c6667dfcfb4e113102b623670e2a8 100644
--- a/chrome/test/data/webui/settings/security_page_test.ts
+++ b/chrome/test/data/webui/settings/security_page_test.ts
@@ -228,6 +228,20 @@ suite('Main', function() {
flush();
assertEquals(lockedSubLabel, toggle.subLabel);
});
+
+ // Tests that only the new Secure DNS toggle is shown when the new
+ // HTTPS-First Mode Settings flag is enabled.
+ // Regression test for crbug.com/365884462
+ // TODO(crbug.com/349860796): Remove when Balanced Mode is fully launched.
+ // <if expr="not is_chromeos">
+ test('SecureDnsToggleNotDuplicated', function() {
+ // Check that the setting under the new element ID visible.
+ assertTrue(isChildVisible(page, '#secureDnsSettingNew'));
+
+ // Check that the setting under the old element ID is not visible.
+ assertFalse(isChildVisible(page, '#secureDnsSettingOld'));
+ });
+ // </if>
});

suite('SecurityPageHappinessTrackingSurveys', function() {
@@ -465,6 +479,20 @@ suite('FlagsDisabled', function() {
assertEquals(lockedSubLabel, toggle.subLabel);
});

+ // Tests that only the old Secure DNS toggle is shown when the new
+ // HTTPS-First Mode Settings flag is disabled.
+ // Regression test for crbug.com/365884462
+ // TODO(crbug.com/349860796): Remove when Balanced Mode is fully launched.
+ // <if expr="not is_chromeos">
+ test('SecureDnsToggleNotDuplicated', function() {
+ // Check that the setting under the new element ID is not visible.
+ assertFalse(isChildVisible(page, '#secureDnsSettingNew'));
+
+ // Check that the setting under the old element ID is visible.
+ assertTrue(isChildVisible(page, '#secureDnsSettingOld'));
+ });
+ // </if>
+
// TODO(crbug.com/349439367): Remove the test once
// kExtendedReportingRemovePrefDependency is fully launched.
test('LogSafeBrowsingExtendedToggle', async function() {

0 comments on commit 34a49b4

Please sign in to comment.