Commit f6d2eeee authored by patricialor's avatar patricialor Committed by Commit Bot

MD Settings: Show all content settings in Site Details.

The "Site Details" page currently only shows content settings that are set to a
non-default setting for the given origin. This patch will show all content
settings in "Site Details", regardless of whether they are still set to the
default setting or not.

BUG=656758,709171
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2912253003
Cr-Commit-Position: refs/heads/master@{#476514}
parent bcca0368
......@@ -80,7 +80,7 @@
label="$i18n{siteSettingsMic}" site="[[site]]">
</site-details-permission>
<site-details-permission category="{{ContentSettingsTypes.NOTIFICATIONS}}"
icon="settings:notifications" id="notification"
icon="settings:notifications" id="notifications"
label="$i18n{siteSettingsNotifications}" site="[[site]]">
</site-details-permission>
<site-details-permission category="{{ContentSettingsTypes.JAVASCRIPT}}"
......
......@@ -12,7 +12,7 @@
<dom-module id="site-details-permission">
<template>
<style include="settings-shared md-select"></style>
<div id="details" hidden>
<div id="details">
<div class="list-item underbar">
<div>
<iron-icon icon="[[icon]]">
......
......@@ -52,7 +52,6 @@ Polymer({
* @private
*/
siteChanged_: function(site) {
this.$.details.hidden = true;
this.browserProxy.getExceptionList(this.category).then(
function(exceptionList) {
......@@ -60,7 +59,6 @@ Polymer({
if (exceptionList[i].embeddingOrigin == site.embeddingOrigin &&
this.sameOrigin_(exceptionList[i].origin, site.origin)) {
this.$.permission.value = exceptionList[i].setting;
this.$.details.hidden = false;
break;
}
}
......@@ -94,7 +92,6 @@ Polymer({
this.browserProxy.resetCategoryPermissionForOrigin(
this.site.origin, this.site.embeddingOrigin, this.category,
this.site.incognito);
this.$.details.hidden = true;
},
/**
......
......@@ -48,6 +48,11 @@ suite('SiteDetailsPermission', function() {
settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
PolymerTest.clearBody();
testElement = document.createElement('site-details-permission');
// Set the camera icon on <site-details-permission> manually to avoid
// failures on undefined icons during teardown in PolymerTest.testIronIcons.
// In practice, this is done from the parent.
testElement.icon = 'settings:videocam';
document.body.appendChild(testElement);
});
......@@ -77,19 +82,6 @@ suite('SiteDetailsPermission', function() {
});
};
test('empty state', function() {
browserProxy.setPrefs(prefsEmpty);
testElement.category = settings.ContentSettingsTypes.CAMERA;
testElement.site = {
origin: 'http://www.google.com',
embeddingOrigin: '',
};
return browserProxy.whenCalled('getExceptionList').then(function() {
assertTrue(testElement.$.details.hidden);
});
});
test('camera category', function() {
var origin = 'https://www.example.com';
browserProxy.setPrefs(prefs);
......@@ -155,25 +147,4 @@ suite('SiteDetailsPermission', function() {
origin, settings.PermissionValues.BLOCK);
});
});
test('disappear on empty', function() {
var origin = 'https://www.example.com';
browserProxy.setPrefs(prefs);
testElement.category = settings.ContentSettingsTypes.CAMERA;
testElement.site = {
origin: origin,
embeddingOrigin: '',
};
return browserProxy.whenCalled('getExceptionList')
.then(function() {
assertFalse(testElement.$.details.hidden);
browserProxy.setPrefs(prefsEmpty);
return browserProxy.whenCalled('getExceptionList');
})
.then(function() {
assertTrue(testElement.$.details.hidden);
});
});
});
......@@ -123,55 +123,6 @@ suite('SiteDetails', function() {
document.body.appendChild(testElement);
});
test('empty state', function() {
var category = settings.ContentSettingsTypes.NOTIFICATIONS;
var site = {
origin: 'http://www.google.com',
displayName: 'http://www.google.com',
embeddingOrigin: '',
};
browserProxy.setPrefs(prefsEmpty);
testElement.category = category;
testElement.site = site
// expect usage to not be rendered
assertFalse(!!testElement.$$('#usage'));
// TODO(finnur): Check for the Permission heading hiding when no
// permissions are showing.
var msg = 'No category should be showing, height';
assertEquals(0, testElement.$.camera.offsetHeight, msg);
assertEquals(0, testElement.$.cookies.offsetHeight, msg);
assertEquals(0, testElement.$.geolocation.offsetHeight, msg);
assertEquals(0, testElement.$.javascript.offsetHeight, msg);
assertEquals(0, testElement.$.mic.offsetHeight, msg);
assertEquals(0, testElement.$.notification.offsetHeight, msg);
assertEquals(0, testElement.$.popups.offsetHeight, msg);
});
test('all categories visible', function() {
var category = settings.ContentSettingsTypes.NOTIFICATIONS;
var site = {
origin: 'https://foo-allow.com:443',
displayName: 'https://foo-allow.com:443',
embeddingOrigin: '',
};
browserProxy.setPrefs(prefs);
testElement.category = category;
testElement.site = site;
var msg = 'All categories should be showing';
assertFalse(testElement.$.camera.hidden, msg);
assertFalse(testElement.$.cookies.hidden, msg);
assertFalse(testElement.$.geolocation.hidden, msg);
assertFalse(testElement.$.javascript.hidden, msg);
assertFalse(testElement.$.mic.hidden, msg);
assertFalse(testElement.$.notification.hidden, msg);
assertFalse(testElement.$.popups.hidden, msg);
});
test('usage heading shows on storage available', function() {
// Remove the current website-usage-private-api element.
var parent = testElement.$.usageApi.parentNode;
......
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