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 @@ ...@@ -80,7 +80,7 @@
label="$i18n{siteSettingsMic}" site="[[site]]"> label="$i18n{siteSettingsMic}" site="[[site]]">
</site-details-permission> </site-details-permission>
<site-details-permission category="{{ContentSettingsTypes.NOTIFICATIONS}}" <site-details-permission category="{{ContentSettingsTypes.NOTIFICATIONS}}"
icon="settings:notifications" id="notification" icon="settings:notifications" id="notifications"
label="$i18n{siteSettingsNotifications}" site="[[site]]"> label="$i18n{siteSettingsNotifications}" site="[[site]]">
</site-details-permission> </site-details-permission>
<site-details-permission category="{{ContentSettingsTypes.JAVASCRIPT}}" <site-details-permission category="{{ContentSettingsTypes.JAVASCRIPT}}"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<dom-module id="site-details-permission"> <dom-module id="site-details-permission">
<template> <template>
<style include="settings-shared md-select"></style> <style include="settings-shared md-select"></style>
<div id="details" hidden> <div id="details">
<div class="list-item underbar"> <div class="list-item underbar">
<div> <div>
<iron-icon icon="[[icon]]"> <iron-icon icon="[[icon]]">
......
...@@ -52,7 +52,6 @@ Polymer({ ...@@ -52,7 +52,6 @@ Polymer({
* @private * @private
*/ */
siteChanged_: function(site) { siteChanged_: function(site) {
this.$.details.hidden = true;
this.browserProxy.getExceptionList(this.category).then( this.browserProxy.getExceptionList(this.category).then(
function(exceptionList) { function(exceptionList) {
...@@ -60,7 +59,6 @@ Polymer({ ...@@ -60,7 +59,6 @@ Polymer({
if (exceptionList[i].embeddingOrigin == site.embeddingOrigin && if (exceptionList[i].embeddingOrigin == site.embeddingOrigin &&
this.sameOrigin_(exceptionList[i].origin, site.origin)) { this.sameOrigin_(exceptionList[i].origin, site.origin)) {
this.$.permission.value = exceptionList[i].setting; this.$.permission.value = exceptionList[i].setting;
this.$.details.hidden = false;
break; break;
} }
} }
...@@ -94,7 +92,6 @@ Polymer({ ...@@ -94,7 +92,6 @@ Polymer({
this.browserProxy.resetCategoryPermissionForOrigin( this.browserProxy.resetCategoryPermissionForOrigin(
this.site.origin, this.site.embeddingOrigin, this.category, this.site.origin, this.site.embeddingOrigin, this.category,
this.site.incognito); this.site.incognito);
this.$.details.hidden = true;
}, },
/** /**
......
...@@ -48,6 +48,11 @@ suite('SiteDetailsPermission', function() { ...@@ -48,6 +48,11 @@ suite('SiteDetailsPermission', function() {
settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
PolymerTest.clearBody(); PolymerTest.clearBody();
testElement = document.createElement('site-details-permission'); 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); document.body.appendChild(testElement);
}); });
...@@ -77,19 +82,6 @@ suite('SiteDetailsPermission', function() { ...@@ -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() { test('camera category', function() {
var origin = 'https://www.example.com'; var origin = 'https://www.example.com';
browserProxy.setPrefs(prefs); browserProxy.setPrefs(prefs);
...@@ -155,25 +147,4 @@ suite('SiteDetailsPermission', function() { ...@@ -155,25 +147,4 @@ suite('SiteDetailsPermission', function() {
origin, settings.PermissionValues.BLOCK); 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() { ...@@ -123,55 +123,6 @@ suite('SiteDetails', function() {
document.body.appendChild(testElement); 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() { test('usage heading shows on storage available', function() {
// Remove the current website-usage-private-api element. // Remove the current website-usage-private-api element.
var parent = testElement.$.usageApi.parentNode; 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