Commit 61ec8f7c authored by Ben Schwartz's avatar Ben Schwartz Committed by Commit Bot

Fix privacy page redesign tests with secure DNS

This change
(1) adds dns_over_https to the tests' fake prefs.
(2) makes TestPrivacyPageBrowserProxy usable in its default state.
(3) adds a check for undefined prefs to secure_dns.js, to match the
other privacy preference UI elements.

Bug: 1087444
Change-Id: Ic8fb7e200d515d7a1da541c62ca3e90640e56060
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2223639Reviewed-by: default avatarEric Orth <ericorth@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Commit-Queue: Ben Schwartz <bemasc@chromium.org>
Auto-Submit: Ben Schwartz <bemasc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774369}
parent 926d36ac
...@@ -292,6 +292,9 @@ Polymer({ ...@@ -292,6 +292,9 @@ Polymer({
* @private * @private
*/ */
updateManagementView_: function(managementMode) { updateManagementView_: function(managementMode) {
if (this.prefs === undefined) {
return;
}
// If the underlying secure DNS mode pref has an enforced value, communicate // If the underlying secure DNS mode pref has an enforced value, communicate
// that via the toggle pref. // that via the toggle pref.
const pref = { const pref = {
......
...@@ -7,7 +7,7 @@ import {isMac, isWindows, webUIListenerCallback} from 'chrome://resources/js/cr. ...@@ -7,7 +7,7 @@ import {isMac, isWindows, webUIListenerCallback} from 'chrome://resources/js/cr.
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {ClearBrowsingDataBrowserProxyImpl, CookieControlsMode, SiteSettingsPrefsBrowserProxyImpl} from 'chrome://settings/lazy_load.js'; import {ClearBrowsingDataBrowserProxyImpl, CookieControlsMode, SiteSettingsPrefsBrowserProxyImpl} from 'chrome://settings/lazy_load.js';
import {HatsBrowserProxyImpl, MetricsBrowserProxyImpl, PrivacyElementInteractions, PrivacyPageBrowserProxyImpl, Router, routes, SyncBrowserProxyImpl} from 'chrome://settings/settings.js'; import {HatsBrowserProxyImpl, MetricsBrowserProxyImpl, PrivacyElementInteractions, PrivacyPageBrowserProxyImpl, Router, routes, SecureDnsMode, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
import {TestClearBrowsingDataBrowserProxy} from 'chrome://test/settings/test_clear_browsing_data_browser_proxy.js'; import {TestClearBrowsingDataBrowserProxy} from 'chrome://test/settings/test_clear_browsing_data_browser_proxy.js';
import {TestHatsBrowserProxy} from 'chrome://test/settings/test_hats_browser_proxy.js'; import {TestHatsBrowserProxy} from 'chrome://test/settings/test_hats_browser_proxy.js';
import {TestMetricsBrowserProxy} from 'chrome://test/settings/test_metrics_browser_proxy.js'; import {TestMetricsBrowserProxy} from 'chrome://test/settings/test_metrics_browser_proxy.js';
...@@ -54,6 +54,8 @@ suite('PrivacyPageUMACheck', function() { ...@@ -54,6 +54,8 @@ suite('PrivacyPageUMACheck', function() {
scout_reporting_enabled: {value: true}, scout_reporting_enabled: {value: true},
enhanced: {value: false} enhanced: {value: false}
}, },
dns_over_https:
{mode: {value: SecureDnsMode.AUTOMATIC}, templates: {value: ''}},
}; };
document.body.appendChild(page); document.body.appendChild(page);
flush(); flush();
...@@ -163,6 +165,8 @@ suite('PrivacyPage', function() { ...@@ -163,6 +165,8 @@ suite('PrivacyPage', function() {
scout_reporting_enabled: {value: true}, scout_reporting_enabled: {value: true},
enhanced: {value: false} enhanced: {value: false}
}, },
dns_over_https:
{mode: {value: SecureDnsMode.AUTOMATIC}, templates: {value: ''}},
}; };
document.body.appendChild(page); document.body.appendChild(page);
return testSyncBrowserProxy.whenCalled('getSyncStatus'); return testSyncBrowserProxy.whenCalled('getSyncStatus');
......
...@@ -8,7 +8,7 @@ import {isMac, isWindows} from 'chrome://resources/js/cr.m.js'; ...@@ -8,7 +8,7 @@ import {isMac, isWindows} from 'chrome://resources/js/cr.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {SafeBrowsingBrowserProxyImpl} from 'chrome://settings/lazy_load.js'; import {SafeBrowsingBrowserProxyImpl} from 'chrome://settings/lazy_load.js';
import {MetricsBrowserProxyImpl, PrivacyElementInteractions,PrivacyPageBrowserProxyImpl, Router, routes, SyncBrowserProxyImpl} from 'chrome://settings/settings.js'; import {MetricsBrowserProxyImpl, PrivacyElementInteractions,PrivacyPageBrowserProxyImpl, Router, routes, SecureDnsMode, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js'; import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js';
import {flushTasks} from '../test_util.m.js'; import {flushTasks} from '../test_util.m.js';
...@@ -65,6 +65,8 @@ suite('CrSettingsSecurityPageTestWithEnhanced', function() { ...@@ -65,6 +65,8 @@ suite('CrSettingsSecurityPageTestWithEnhanced', function() {
scout_reporting_enabled: {value: true}, scout_reporting_enabled: {value: true},
enhanced: {value: false} enhanced: {value: false}
}, },
dns_over_https:
{mode: {value: SecureDnsMode.AUTOMATIC}, templates: {value: ''}},
}; };
document.body.appendChild(page); document.body.appendChild(page);
flush(); flush();
...@@ -424,6 +426,8 @@ suite('CrSettingsSecurityPageTestWithoutEnhanced', function() { ...@@ -424,6 +426,8 @@ suite('CrSettingsSecurityPageTestWithoutEnhanced', function() {
scout_reporting_enabled: {value: true}, scout_reporting_enabled: {value: true},
enhanced: {value: false} enhanced: {value: false}
}, },
dns_over_https:
{mode: {value: SecureDnsMode.AUTOMATIC}, templates: {value: ''}},
}; };
document.body.appendChild(page); document.body.appendChild(page);
flush(); flush();
......
...@@ -35,7 +35,7 @@ export class TestPrivacyPageBrowserProxy extends TestBrowserProxy { ...@@ -35,7 +35,7 @@ export class TestPrivacyPageBrowserProxy extends TestBrowserProxy {
* @private * @private
*/ */
this.secureDnsSetting = { this.secureDnsSetting = {
mode: SecureDnsMode.SECURE, mode: SecureDnsMode.AUTOMATIC,
templates: [], templates: [],
managementMode: SecureDnsUiManagementMode.NO_OVERRIDE, managementMode: SecureDnsUiManagementMode.NO_OVERRIDE,
}; };
...@@ -44,7 +44,7 @@ export class TestPrivacyPageBrowserProxy extends TestBrowserProxy { ...@@ -44,7 +44,7 @@ export class TestPrivacyPageBrowserProxy extends TestBrowserProxy {
* @type {!Array<!ResolverOption>} * @type {!Array<!ResolverOption>}
* @private * @private
*/ */
this.resolverList_; this.resolverList_ = [{name: 'Custom', value: 'custom', policy: ''}];
/** /**
* @type {!Array<string>} * @type {!Array<string>}
......
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