Commit 55a9fcc8 authored by Tymofii Chudakov's avatar Tymofii Chudakov Committed by Commit Bot

WebUI Settings: Content settings redesign, hidden under a flag.

Use category-default-setting-radio component to implement privacy
page redesign, which is hidden under a flag. The following content
setting categories are redesigned in this CL:
- ADS                             - MIDI_DEVICES
- AR                              - PAYMENT_HANDLERS
- AUTOMATIC DOWNLOADS             - PLUGINS
- BACKGROUND_SYNC                 - POPUPS
- CAMERA                          - SENSORS
- CLIPBOARD                       - SERIAL_PORTS
- FILE_SYSTEM_WRITE               - SOUND
- GEOLOCATION                     - UNSANDBOXED_PLUGINS
- IMAGES                          - USB_DEVICES
- JAVASCRIPT                      - VR
- MIC                             - ZOOM_LEVELS


Bug: 1113642
Change-Id: If1b3503efa459cb05d83bd7a8dc1fc6933e205b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323390
Commit-Queue: Tymofii Chudakov <tchudakov@chromium.org>
Reviewed-by: default avatarTheodore Olsauskas-Warren <sauski@google.com>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807887}
parent 0bb413bf
This diff is collapsed.
af33578dd4141ae5fb23545465977d9412b591be
\ No newline at end of file
af33578dd4141ae5fb23545465977d9412b591be
\ No newline at end of file
af33578dd4141ae5fb23545465977d9412b591be
\ No newline at end of file
cf8cd2153e16dace6b6d8e577f374c2b6b1ba7be
\ No newline at end of file
cf8cd2153e16dace6b6d8e577f374c2b6b1ba7be
\ No newline at end of file
cf8cd2153e16dace6b6d8e577f374c2b6b1ba7be
\ No newline at end of file
38000b8a76679d71bc28b53e0c98ef8e23bf900a
\ No newline at end of file
38000b8a76679d71bc28b53e0c98ef8e23bf900a
\ No newline at end of file
38000b8a76679d71bc28b53e0c98ef8e23bf900a
\ No newline at end of file
9b7c8d6f332ba94c05453b6c8f80a146f3498cf7
\ No newline at end of file
b3212babc6a621020a87c46df0be6d9823b25eb2
\ No newline at end of file
9b7c8d6f332ba94c05453b6c8f80a146f3498cf7
\ No newline at end of file
9b7c8d6f332ba94c05453b6c8f80a146f3498cf7
\ No newline at end of file
69bf88f767318f68d68c437b99a1b1eeede2fb4f
\ No newline at end of file
69bf88f767318f68d68c437b99a1b1eeede2fb4f
\ No newline at end of file
69bf88f767318f68d68c437b99a1b1eeede2fb4f
\ No newline at end of file
69bf88f767318f68d68c437b99a1b1eeede2fb4f
\ No newline at end of file
dfc6fa04759cb5999e7488027a3efd686f9e1897
\ No newline at end of file
dfc6fa04759cb5999e7488027a3efd686f9e1897
\ No newline at end of file
dfc6fa04759cb5999e7488027a3efd686f9e1897
\ No newline at end of file
a1f2092ce23aa6c0a2fa2e4df932e281b222fc86
\ No newline at end of file
a1f2092ce23aa6c0a2fa2e4df932e281b222fc86
\ No newline at end of file
a1f2092ce23aa6c0a2fa2e4df932e281b222fc86
\ No newline at end of file
87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f
\ No newline at end of file
87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f
\ No newline at end of file
87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f
\ No newline at end of file
44f9c0a979b566f4d418965831cc84ffd299c860
\ No newline at end of file
44f9c0a979b566f4d418965831cc84ffd299c860
\ No newline at end of file
44f9c0a979b566f4d418965831cc84ffd299c860
\ No newline at end of file
4c4d73ad5acb8164701626388044cf0f8a0d7e26
\ No newline at end of file
4c4d73ad5acb8164701626388044cf0f8a0d7e26
\ No newline at end of file
4c4d73ad5acb8164701626388044cf0f8a0d7e26
\ No newline at end of file
b37d5830ab844b5a03b5c01ce35d6fa30f2e6b8a
\ No newline at end of file
b37d5830ab844b5a03b5c01ce35d6fa30f2e6b8a
\ No newline at end of file
b37d5830ab844b5a03b5c01ce35d6fa30f2e6b8a
\ No newline at end of file
b37d5830ab844b5a03b5c01ce35d6fa30f2e6b8a
\ No newline at end of file
adf00c89e3d5d85f305f7f1d49690a8f53e2b5e9
\ No newline at end of file
adf00c89e3d5d85f305f7f1d49690a8f53e2b5e9
\ No newline at end of file
adf00c89e3d5d85f305f7f1d49690a8f53e2b5e9
\ No newline at end of file
adf00c89e3d5d85f305f7f1d49690a8f53e2b5e9
\ No newline at end of file
093bf5dea2c0ad273bc53ea3ca8688a74bb2549f
\ No newline at end of file
093bf5dea2c0ad273bc53ea3ca8688a74bb2549f
\ No newline at end of file
093bf5dea2c0ad273bc53ea3ca8688a74bb2549f
\ No newline at end of file
a9e2d0dddfb1f22ccfb4008ad421be93d0c519e8
\ No newline at end of file
a9e2d0dddfb1f22ccfb4008ad421be93d0c519e8
\ No newline at end of file
a9e2d0dddfb1f22ccfb4008ad421be93d0c519e8
\ No newline at end of file
b1894e872b3d554addb05ae39fda674e12aa124c
\ No newline at end of file
b1894e872b3d554addb05ae39fda674e12aa124c
\ No newline at end of file
b1894e872b3d554addb05ae39fda674e12aa124c
\ No newline at end of file
eb104c819cc41428ed16e205e34a1e12a3c382f5
\ No newline at end of file
eb104c819cc41428ed16e205e34a1e12a3c382f5
\ No newline at end of file
eb104c819cc41428ed16e205e34a1e12a3c382f5
\ No newline at end of file
6cc2461c2e5f3bdaae6f1b124ac9bf31c890873e
\ No newline at end of file
13fa4688aa2d0b3094868d8af95179329f516618
\ No newline at end of file
6cc2461c2e5f3bdaae6f1b124ac9bf31c890873e
\ No newline at end of file
17089dfcc469071461596ae9451eec0e2f1b3b4f
\ No newline at end of file
17089dfcc469071461596ae9451eec0e2f1b3b4f
\ No newline at end of file
17089dfcc469071461596ae9451eec0e2f1b3b4f
\ No newline at end of file
315079d5b99dfedc1c0034c70b5f9789e6ac6249
\ No newline at end of file
315079d5b99dfedc1c0034c70b5f9789e6ac6249
\ No newline at end of file
315079d5b99dfedc1c0034c70b5f9789e6ac6249
\ No newline at end of file
c0a918e270c8576e5fbe475d73922aa7149c519a
\ No newline at end of file
c0a918e270c8576e5fbe475d73922aa7149c519a
\ No newline at end of file
c0a918e270c8576e5fbe475d73922aa7149c519a
\ No newline at end of file
771d0cac4c7906c877c7a95956ed47ae3468622d
\ No newline at end of file
771d0cac4c7906c877c7a95956ed47ae3468622d
\ No newline at end of file
771d0cac4c7906c877c7a95956ed47ae3468622d
\ No newline at end of file
c05ab867ffc64e8ff50766cd034c0a46e4610dc9
\ No newline at end of file
c05ab867ffc64e8ff50766cd034c0a46e4610dc9
\ No newline at end of file
c05ab867ffc64e8ff50766cd034c0a46e4610dc9
\ No newline at end of file
818903673c5cb01196e65f1d067cdaa2a5f457ca
\ No newline at end of file
......@@ -14,6 +14,7 @@ import 'chrome://resources/cr_elements/shared_style_css.m.js';
import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js';
import '../controls/settings_toggle_button.m.js';
import '../prefs/prefs.m.js';
import '../site_settings/settings_category_default_radio_group.js';
import '../settings_page/settings_animated_pages.m.js';
import '../settings_page/settings_subpage.m.js';
import '../settings_shared_css.m.js';
......@@ -109,6 +110,14 @@ Polymer({
}
},
/** @private */
enableContentSettingsRedesign_: {
type: Boolean,
value() {
return loadTimeData.getBoolean('enableContentSettingsRedesign');
}
},
/** @private */
enablePaymentHandlerContentSetting_: {
type: Boolean,
......
......@@ -8,6 +8,10 @@
padding-bottom: 10px;
}
settings-collapse-radio-button {
--settings-collapse-toggle-min-height: var(--settings-row-min-height);
}
settings-collapse-radio-button:not(:first-of-type) {
--settings-collapse-separator-line: var(--cr-separator-line);
}
......
......@@ -1763,8 +1763,8 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_ALLOW_RECENTLY_CLOSED_SITES},
{"siteSettingsAllowRecentlyClosedSitesRecommended",
IDS_SETTINGS_SITE_SETTINGS_ALLOW_RECENTLY_CLOSED_SITES_RECOMMENDED},
{"siteSettingsBackgroundSyncBlocked",
IDS_SETTINGS_SITE_SETTINGS_BACKGROUND_SYNC_BLOCKED},
{"siteSettingsBackgroundSyncBlock",
IDS_SETTINGS_SITE_SETTINGS_BACKGROUND_SYNC_BLOCK},
{"siteSettingsHandlersAsk", IDS_SETTINGS_SITE_SETTINGS_HANDLERS_ASK},
{"siteSettingsHandlersAskRecommended",
IDS_SETTINGS_SITE_SETTINGS_HANDLERS_ASK_RECOMMENDED},
......@@ -1949,6 +1949,121 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_DEFAULT_BEHAVIOR},
{"siteSettingsDefaultBehaviorDescription",
IDS_SETTINGS_SITE_SETTINGS_DEFAULT_BEHAVIOR_DESCRIPTION},
{"siteSettingsAdsDescription", IDS_SETTINGS_SITE_SETTINGS_ADS_DESCRIPTION},
{"siteSettingsAdsAllowed", IDS_SETTINGS_SITE_SETTINGS_ADS_ALLOWED},
{"siteSettingsAdsBlocked", IDS_SETTINGS_SITE_SETTINGS_ADS_BLOCKED},
{"siteSettingsArDescription", IDS_SETTINGS_SITE_SETTINGS_AR_DESCRIPTION},
{"siteSettingsArAllowed", IDS_SETTINGS_SITE_SETTINGS_AR_ALLOWED},
{"siteSettingsArBlocked", IDS_SETTINGS_SITE_SETTINGS_AR_BLOCKED},
{"siteSettingsAutomaticDownloadsDescription",
IDS_SETTINGS_SITE_SETTINGS_AUTOMATIC_DOWNLOADS_DESCRIPTION},
{"siteSettingsAutomaticDownloadsAllowed",
IDS_SETTINGS_SITE_SETTINGS_AUTOMATIC_DOWNLOADS_ALLOWED},
{"siteSettingsAutomaticDownloadsBlocked",
IDS_SETTINGS_SITE_SETTINGS_AUTOMATIC_DOWNLOADS_BLOCKED},
{"siteSettingsBackgroundSyncDescription",
IDS_SETTINGS_SITE_SETTINGS_BACKGROUND_SYNC_DESCRIPTION},
{"siteSettingsBackgroundSyncAllowed",
IDS_SETTINGS_SITE_SETTINGS_BACKGROUND_SYNC_ALLOWED},
{"siteSettingsBackgroundSyncBlocked",
IDS_SETTINGS_SITE_SETTINGS_BACKGROUND_SYNC_BLOCKED},
{"siteSettingsCameraDescription",
IDS_SETTINGS_SITE_SETTINGS_CAMERA_DESCRIPTION},
{"siteSettingsCameraAllowed", IDS_SETTINGS_SITE_SETTINGS_CAMERA_ALLOWED},
{"siteSettingsCameraBlocked", IDS_SETTINGS_SITE_SETTINGS_CAMERA_BLOCKED},
{"siteSettingsCameraBlockedSubLabel",
IDS_SETTINGS_SITE_SETTINGS_CAMERA_BLOCKED_SUB_LABEL},
{"siteSettingsClipboardDescription",
IDS_SETTINGS_SITE_SETTINGS_CLIPBOARD_DESCRIPTION},
{"siteSettingsClipboardAllowed",
IDS_SETTINGS_SITE_SETTINGS_CLIPBOARD_ALLOWED},
{"siteSettingsClipboardBlocked",
IDS_SETTINGS_SITE_SETTINGS_CLIPBOARD_BLOCKED},
{"siteSettingsFileSystemWriteDescription",
IDS_SETTINGS_SITE_SETTINGS_FILE_SYSTEM_WRITE_DESCRIPTION},
{"siteSettingsFileSystemWriteAllowed",
IDS_SETTINGS_SITE_SETTINGS_FILE_SYSTEM_WRITE_ALLOWED},
{"siteSettingsFileSystemWriteBlocked",
IDS_SETTINGS_SITE_SETTINGS_FILE_SYSTEM_WRITE_BLOCKED},
{"siteSettingsLocationDescription",
IDS_SETTINGS_SITE_SETTINGS_LOCATION_DESCRIPTION},
{"siteSettingsLocationAllowed",
IDS_SETTINGS_SITE_SETTINGS_LOCATION_ALLOWED},
{"siteSettingsLocationBlocked",
IDS_SETTINGS_SITE_SETTINGS_LOCATION_BLOCKED},
{"siteSettingsLocationBlockedSubLabel",
IDS_SETTINGS_SITE_SETTINGS_LOCATION_BLOCKED_SUB_LABEL},
{"siteSettingsImagesDescription",
IDS_SETTINGS_SITE_SETTINGS_IMAGES_DESCRIPTION},
{"siteSettingsImagesAllowed", IDS_SETTINGS_SITE_SETTINGS_IMAGES_ALLOWED},
{"siteSettingsImagesBlocked", IDS_SETTINGS_SITE_SETTINGS_IMAGES_BLOCKED},
{"siteSettingsJavascriptDescription",
IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_DESCRIPTION},
{"siteSettingsJavascriptAllowed",
IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_ALLOWED},
{"siteSettingsJavascriptBlocked",
IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_BLOCKED},
{"siteSettingsMicDescription", IDS_SETTINGS_SITE_SETTINGS_MIC_DESCRIPTION},
{"siteSettingsMicAllowed", IDS_SETTINGS_SITE_SETTINGS_MIC_ALLOWED},
{"siteSettingsMicBlocked", IDS_SETTINGS_SITE_SETTINGS_MIC_BLOCKED},
{"siteSettingsMicBlockedSubLabel",
IDS_SETTINGS_SITE_SETTINGS_MIC_BLOCKED_SUB_LABEL},
{"siteSettingsMidiDescription",
IDS_SETTINGS_SITE_SETTINGS_MIDI_DESCRIPTION},
{"siteSettingsMidiAllowed", IDS_SETTINGS_SITE_SETTINGS_MIDI_ALLOWED},
{"siteSettingsMidiBlocked", IDS_SETTINGS_SITE_SETTINGS_MIDI_BLOCKED},
{"siteSettingsPaymentHandlersDescription",
IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_DESCRIPTION},
{"siteSettingsPaymentHandlersAllowed",
IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_ALLOWED},
{"siteSettingsPaymentHandlersBlocked",
IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_BLOCKED},
{"siteSettingsFlashDescription",
IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION},
{"siteSettingsFlashAllowed", IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED},
{"siteSettingsFlashBlocked", IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED},
{"siteSettingsPopupsDescription",
IDS_SETTINGS_SITE_SETTINGS_POPUPS_DESCRIPTION},
{"siteSettingsPopupsAllowed", IDS_SETTINGS_SITE_SETTINGS_POPUPS_ALLOWED},
{"siteSettingsPopupsBlocked", IDS_SETTINGS_SITE_SETTINGS_POPUPS_BLOCKED},
{"siteSettingsProtectedContentDescription",
IDS_SETTINGS_SITE_SETTINGS_PROTECTED_CONTENT_DESCRIPTION},
{"siteSettingsProtectedContentAllowed",
IDS_SETTINGS_SITE_SETTINGS_PROTECTED_CONTENT_ALLOWED},
{"siteSettingsProtectedContentBlocked",
IDS_SETTINGS_SITE_SETTINGS_PROTECTED_CONTENT_BLOCKED},
{"siteSettingsMotionSensorsDescription",
IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_DESCRIPTION},
{"siteSettingsMotionSensorsAllowed",
IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_ALLOWED},
{"siteSettingsMotionSensorsBlocked",
IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_BLOCKED},
{"siteSettingsMotionSensorsBlockedSubLabel",
IDS_SETTINGS_SITE_SETTINGS_MOTION_SENSORS_BLOCKED_SUB_LABEL},
{"siteSettingsSerialPortsDescription",
IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_DESCRIPTION},
{"siteSettingsSerialPortsAllowed",
IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_ALLOWED},
{"siteSettingsSerialPortsBlocked",
IDS_SETTINGS_SITE_SETTINGS_SERIAL_PORTS_BLOCKED},
{"siteSettingsSoundDescription",
IDS_SETTINGS_SITE_SETTINGS_SOUND_DESCRIPTION},
{"siteSettingsSoundAllowed", IDS_SETTINGS_SITE_SETTINGS_SOUND_ALLOWED},
{"siteSettingsSoundBlocked", IDS_SETTINGS_SITE_SETTINGS_SOUND_BLOCKED},
{"siteSettingsUnsandboxedPluginsDescription",
IDS_SETTINGS_SITE_SETTINGS_UNSANDBOXED_PLUGINS_DESCRIPTION},
{"siteSettingsUnsandboxedPluginsAllowed",
IDS_SETTINGS_SITE_SETTINGS_UNSANDBOXED_PLUGINS_ALLOWED},
{"siteSettingsUnsandboxedPluginsBlocked",
IDS_SETTINGS_SITE_SETTINGS_UNSANDBOXED_PLUGINS_BLOCKED},
{"siteSettingsUsbDescription", IDS_SETTINGS_SITE_SETTINGS_USB_DESCRIPTION},
{"siteSettingsUsbAllowed", IDS_SETTINGS_SITE_SETTINGS_USB_ALLOWED},
{"siteSettingsUsbBlocked", IDS_SETTINGS_SITE_SETTINGS_USB_BLOCKED},
{"siteSettingsVrDescription", IDS_SETTINGS_SITE_SETTINGS_VR_DESCRIPTION},
{"siteSettingsVrAllowed", IDS_SETTINGS_SITE_SETTINGS_VR_ALLOWED},
{"siteSettingsVrBlocked", IDS_SETTINGS_SITE_SETTINGS_VR_BLOCKED},
{"siteSettingsZoomLevelsDescription",
IDS_SETTINGS_SITE_SETTINGS_ZOOM_LEVELS_DESCRIPTION},
{"siteSettingsAds", IDS_SETTINGS_SITE_SETTINGS_ADS},
{"siteSettingsAdsBlock", IDS_SETTINGS_SITE_SETTINGS_ADS_BLOCK},
{"siteSettingsAdsBlockRecommended",
......
......@@ -413,6 +413,10 @@ TEST_F('CrSettingsPrivacyPageV3Test', 'PrivacyPageTests', function() {
runMochaSuite('PrivacyPage');
});
TEST_F('CrSettingsPrivacyPageV3Test', 'ContentSettingsRedesign', function() {
runMochaSuite('ContentSettingsRedesign');
});
// TODO(crbug.com/1043665): flaky crash on Linux Tests (dbg).
TEST_F(
'CrSettingsPrivacyPageV3Test', 'DISABLED_PrivacyPageSoundTests',
......
......@@ -7,7 +7,7 @@ import {webUIListenerCallback} from 'chrome://resources/js/cr.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 {ClearBrowsingDataBrowserProxyImpl, CookieControlsMode, SafeBrowsingSetting, SiteSettingsPrefsBrowserProxyImpl} from 'chrome://settings/lazy_load.js';
import {HatsBrowserProxyImpl, MetricsBrowserProxyImpl, PrivacyElementInteractions, PrivacyPageBrowserProxyImpl, Router, routes, SecureDnsMode, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
import {HatsBrowserProxyImpl, MetricsBrowserProxyImpl, PrivacyElementInteractions, PrivacyPageBrowserProxyImpl, Route, Router, routes, SecureDnsMode, SyncBrowserProxyImpl} from 'chrome://settings/settings.js';
import {assertEquals, assertFalse, assertTrue} from '../chai_assert.js';
import {flushTasks} from '../test_util.m.js';
......@@ -21,6 +21,49 @@ import {TestSyncBrowserProxy} from './test_sync_browser_proxy.m.js';
// clang-format on
/** @type {!Array<!Route>} */
const redesignedPages = [
routes.SITE_SETTINGS_ADS,
routes.SITE_SETTINGS_AR,
routes.SITE_SETTINGS_AUTOMATIC_DOWNLOADS,
routes.SITE_SETTINGS_BACKGROUND_SYNC,
routes.SITE_SETTINGS_CAMERA,
routes.SITE_SETTINGS_CLIPBOARD,
routes.SITE_SETTINGS_FLASH,
routes.SITE_SETTINGS_IMAGES,
routes.SITE_SETTINGS_JAVASCRIPT,
routes.SITE_SETTINGS_LOCATION,
routes.SITE_SETTINGS_MICROPHONE,
routes.SITE_SETTINGS_MIDI_DEVICES,
routes.SITE_SETTINGS_POPUPS,
routes.SITE_SETTINGS_SENSORS,
routes.SITE_SETTINGS_SERIAL_PORTS,
routes.SITE_SETTINGS_SOUND,
routes.SITE_SETTINGS_UNSANDBOXED_PLUGINS,
routes.SITE_SETTINGS_USB_DEVICES,
routes.SITE_SETTINGS_VR,
// TODO(crbug.com/1128902) After restructure add coverage for elements on
// routes which depend on flags being enabled.
// routes.SITE_SETTINGS_FILE_SYSTEM_WRITE,
// routes.SITE_SETTINGS_PAYMENT_HANDLER,
// Doesn't contain toggle or radio buttons
// routes.SITE_SETTINGS_ZOOM_LEVELS,
];
/** @type {!Array<!Route>} */
const notRedesignedPages = [
routes.SITE_SETTINGS_NOTIFICATIONS,
routes.SITE_SETTINGS_HID_DEVICES,
// Content settings that depend on flags being enabled.
// routes.SITE_SETTINGS_BLUETOOTH_SCANNING,
// routes.SITE_SETTINGS_BLUETOOTH_DEVICES,
// routes.SITE_SETTINGS_WINDOW_PLACEMENT,
// routes.SITE_SETTINGS_FONT_ACCESS,
];
suite('PrivacyPage', function() {
/** @type {!SettingsPrivacyPageElement} */
let page;
......@@ -34,6 +77,12 @@ suite('PrivacyPage', function() {
/** @type {!Array<string>} */
const testLabels = ['test label 1', 'test label 2'];
suiteSetup(function() {
loadTimeData.overrideValues({
enableContentSettingsRedesign: false,
});
});
setup(async function() {
testClearBrowsingDataBrowserProxy = new TestClearBrowsingDataBrowserProxy();
ClearBrowsingDataBrowserProxyImpl.instance_ =
......@@ -89,6 +138,61 @@ suite('PrivacyPage', function() {
webUIListenerCallback('cookieSettingDescriptionChanged', testLabels[1]);
assertEquals(page.$$('#cookiesLinkRow').subLabel, testLabels[1]);
});
test('ContentSettingsRedesignVisibility', async function() {
// Ensure pages are visited so that HTML components are stamped.
redesignedPages.forEach(route => Router.getInstance().navigateTo(route));
notRedesignedPages.forEach(route => Router.getInstance().navigateTo(route));
assertFalse(loadTimeData.getBoolean('enableContentSettingsRedesign'));
assertEquals(
page.root.querySelectorAll('category-default-setting').length,
redesignedPages.length + notRedesignedPages.length);
assertEquals(
page.root.querySelectorAll('settings-category-default-radio-group')
.length,
0);
});
});
suite('ContentSettingsRedesign', function() {
/** @type {!SettingsPrivacyPageElement} */
let page;
suiteSetup(function() {
loadTimeData.overrideValues({
enableContentSettingsRedesign: true,
});
});
setup(async function() {
document.body.innerHTML = '';
page = /** @type {!SettingsPrivacyPageElement} */
(document.createElement('settings-privacy-page'));
document.body.appendChild(page);
flush();
});
teardown(function() {
page.remove();
Router.getInstance().navigateTo(routes.BASIC);
});
test('ContentSettingsRedesignVisibility', async function() {
// Ensure pages are visited so that HTML components are stamped.
redesignedPages.forEach(route => Router.getInstance().navigateTo(route));
notRedesignedPages.forEach(route => Router.getInstance().navigateTo(route));
assertTrue(loadTimeData.getBoolean('enableContentSettingsRedesign'));
assertEquals(
page.root.querySelectorAll('category-default-setting').length,
notRedesignedPages.length);
assertEquals(
page.root.querySelectorAll('settings-category-default-radio-group')
.length,
redesignedPages.length);
});
});
suite('PrivacyPageSound', function() {
......
......@@ -208,6 +208,10 @@ export function createOriginInfo(origin, override) {
*/
export function getContentSettingsTypeFromChooserType(chooserType) {
switch (chooserType) {
case ChooserType.HID_DEVICES:
return ContentSettingsTypes.HID_DEVICES;
case ChooserType.SERIAL_PORTS:
return ContentSettingsTypes.SERIAL_PORTS;
case ChooserType.USB_DEVICES:
return ContentSettingsTypes.USB_DEVICES;
default:
......
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