Commit a6c0e102 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

[Autoplay] Use custom wording on site details UI

This implements slide 13 of the spec attached to the bug
on the site details page.

When we enable the new unified autoplay sound settings UI the
sound settings dropdown on the site details UI should have custom
wording based on the state of the sound content setting and
the unified autoplay enabled pref.

BUG=865548

Change-Id: Id52b7cb9d1fdf06236a0094621fea9c46569cf34
Reviewed-on: https://chromium-review.googlesource.com/1160873
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583521}
parent 7f9e1603
...@@ -2962,9 +2962,15 @@ ...@@ -2962,9 +2962,15 @@
<message name="IDS_SETTINGS_SITE_SETTINGS_ALLOW_DEFAULT_MENU" desc="Label for the default menu item to allow a permission for a particular site."> <message name="IDS_SETTINGS_SITE_SETTINGS_ALLOW_DEFAULT_MENU" desc="Label for the default menu item to allow a permission for a particular site.">
Allow (default) Allow (default)
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_AUTOMATIC_DEFAULT_MENU" desc="Label for the default menu item to automatically control autoplay for a particular site.">
Automatic (default)
</message>
<message name="IDS_SETTINGS_SITE_SETTINGS_BLOCK_DEFAULT_MENU" desc="Label for the default menu item to block a permission for a particular site."> <message name="IDS_SETTINGS_SITE_SETTINGS_BLOCK_DEFAULT_MENU" desc="Label for the default menu item to block a permission for a particular site.">
Block (default) Block (default)
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_MUTE_DEFAULT_MENU" desc="Label for the default menu item to mute sound for a particular site.">
Mute (default)
</message>
<!-- TODO(https://crbug.com/753173): Consolidate these strings with those used in the Page Info bubble. --> <!-- TODO(https://crbug.com/753173): Consolidate these strings with those used in the Page Info bubble. -->
<message name="IDS_SETTINGS_SITE_SETTINGS_ALLOW_MENU" desc="Label for the menu item to allow permission for a particular site."> <message name="IDS_SETTINGS_SITE_SETTINGS_ALLOW_MENU" desc="Label for the menu item to allow permission for a particular site.">
Allow Allow
...@@ -2975,6 +2981,9 @@ ...@@ -2975,6 +2981,9 @@
<message name="IDS_SETTINGS_SITE_SETTINGS_ASK_MENU" desc="Label for the menu item to ask for permission for a particular site."> <message name="IDS_SETTINGS_SITE_SETTINGS_ASK_MENU" desc="Label for the menu item to ask for permission for a particular site.">
Ask Ask
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_MUTE_MENU" desc="Label for the menu item to mute sound for a particular site.">
Mute
</message>
<message name="IDS_SETTINGS_SITE_SETTINGS_RESET_MENU" desc="Label for the menu item to remove the permission for a particular site (make it ask you again next time)."> <message name="IDS_SETTINGS_SITE_SETTINGS_RESET_MENU" desc="Label for the menu item to remove the permission for a particular site (make it ask you again next time).">
Remove Remove
</message> </message>
......
...@@ -484,7 +484,10 @@ ...@@ -484,7 +484,10 @@
</template> </template>
<template is="dom-if" route-path="/content/siteDetails" no-search> <template is="dom-if" route-path="/content/siteDetails" no-search>
<settings-subpage page-title="[[pageTitle]]"> <settings-subpage page-title="[[pageTitle]]">
<site-details page-title="{{pageTitle}}"></site-details> <site-details
page-title="{{pageTitle}}"
block-autoplay-enabled="[[blockAutoplayStatus_.pref.value]]">
</site-details>
</settings-subpage> </settings-subpage>
</template> </template>
<template is="dom-if" route-path="/cookies/detail" no-search> <template is="dom-if" route-path="/cookies/detail" no-search>
......
...@@ -181,6 +181,7 @@ js_library("site_details_permission") { ...@@ -181,6 +181,7 @@ js_library("site_details_permission") {
":site_settings_behavior", ":site_settings_behavior",
"//ui/webui/resources/js:assert", "//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr", "//ui/webui/resources/js:cr",
"//ui/webui/resources/js:i18n_behavior",
"//ui/webui/resources/js:load_time_data", "//ui/webui/resources/js:load_time_data",
"//ui/webui/resources/js:web_ui_listener_behavior", "//ui/webui/resources/js:web_ui_listener_behavior",
] ]
......
...@@ -148,7 +148,8 @@ ...@@ -148,7 +148,8 @@
</site-details-permission> </site-details-permission>
<site-details-permission category="{{ContentSettingsTypes.SOUND}}" <site-details-permission category="{{ContentSettingsTypes.SOUND}}"
icon="settings:volume-up" id="sound" icon="settings:volume-up" id="sound"
label="$i18n{siteSettingsSound}"> label="$i18n{siteSettingsSound}"
use-automatic-label="[[blockAutoplayEnabled]]">
</site-details-permission> </site-details-permission>
<site-details-permission <site-details-permission
category="{{ContentSettingsTypes.AUTOMATIC_DOWNLOADS}}" category="{{ContentSettingsTypes.AUTOMATIC_DOWNLOADS}}"
......
...@@ -16,6 +16,11 @@ Polymer({ ...@@ -16,6 +16,11 @@ Polymer({
], ],
properties: { properties: {
/**
* Whether unified autoplay blocking is enabled.
*/
blockAutoplayEnabled: Boolean,
/** /**
* The origin that this widget is showing details for. * The origin that this widget is showing details for.
* @private * @private
...@@ -72,6 +77,9 @@ Polymer({ ...@@ -72,6 +77,9 @@ Polymer({
this.addWebUIListener( this.addWebUIListener(
'prefEnableDrmChanged', this.prefEnableDrmChanged_.bind(this)); 'prefEnableDrmChanged', this.prefEnableDrmChanged_.bind(this));
// </if> // </if>
// Refresh block autoplay status from the backend.
this.browserProxy.fetchBlockAutoplayStatus();
}, },
/** @override */ /** @override */
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<link rel="import" href="chrome://resources/html/md_select_css.html"> <link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html"> <link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="../settings_shared_css.html"> <link rel="import" href="../settings_shared_css.html">
<link rel="import" href="../settings_vars_css.html"> <link rel="import" href="../settings_vars_css.html">
<link rel="import" href="constants.html"> <link rel="import" href="constants.html">
...@@ -53,16 +54,18 @@ ...@@ -53,16 +54,18 @@
<option id="default" value$="[[ContentSetting.DEFAULT]]"> <option id="default" value$="[[ContentSetting.DEFAULT]]">
[[defaultSettingString_( [[defaultSettingString_(
defaultSetting_, defaultSetting_,
'$i18nPolymer{siteSettingsActionAskDefault}', category,
'$i18nPolymer{siteSettingsActionAllowDefault}', useAutomaticLabel)]]
'$i18nPolymer{siteSettingsActionBlockDefault}')]]
</option> </option>
<option id="allow" value$="[[ContentSetting.ALLOW]]" <option id="allow" value$="[[ContentSetting.ALLOW]]"
hidden$="[[!showAllowedSetting_(category)]]"> hidden$="[[!showAllowedSetting_(category)]]">
$i18n{siteSettingsActionAllow} $i18n{siteSettingsActionAllow}
</option> </option>
<option id="block" value$="[[ContentSetting.BLOCK]]"> <option id="block" value$="[[ContentSetting.BLOCK]]">
$i18n{siteSettingsActionBlock} [[blockSettingString_(
category,
'$i18n{siteSettingsActionBlock}',
'$i18n{siteSettingsActionMute}')]]
</option> </option>
<option id="ask" value$="[[ContentSetting.ASK]]" <option id="ask" value$="[[ContentSetting.ASK]]"
hidden$="[[!showAskSetting_(category, site.setting, hidden$="[[!showAskSetting_(category, site.setting,
......
...@@ -10,9 +10,16 @@ ...@@ -10,9 +10,16 @@
Polymer({ Polymer({
is: 'site-details-permission', is: 'site-details-permission',
behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], behaviors: [I18nBehavior, SiteSettingsBehavior, WebUIListenerBehavior],
properties: { properties: {
/**
* If this is a sound content setting, then this controls whether it
* should use "Automatic" instead of "Allow" as the default setting
* allow label.
*/
useAutomaticLabel: {type: Boolean, value: false},
/** /**
* The site that this widget is showing details for. * The site that this widget is showing details for.
* @type {RawSiteException} * @type {RawSiteException}
...@@ -98,30 +105,63 @@ Polymer({ ...@@ -98,30 +105,63 @@ Polymer({
this.site.origin, [this.category], this.$.permission.value); this.site.origin, [this.category], this.$.permission.value);
}, },
/**
* Returns if we should use the custom labels for the sound type.
* @param {!settings.ContentSettingsTypes} category The permission type.
* @return {boolean}
* @private
*/
useCustomSoundLabels_: function(category) {
return category == settings.ContentSettingsTypes.SOUND &&
loadTimeData.getBoolean('enableBlockAutoplayContentSetting');
},
/** /**
* Updates the string used for this permission category's default setting. * Updates the string used for this permission category's default setting.
* @param {!settings.ContentSetting} defaultSetting Value of the default * @param {!settings.ContentSetting} defaultSetting Value of the default
* setting for this permission category. * setting for this permission category.
* @param {string} askString 'Ask' label, e.g. 'Ask (default)'. * @param {!settings.ContentSettingsTypes} category The permission type.
* @param {string} allowString 'Allow' label, e.g. 'Allow (default)'. * @param {boolean} useAutomaticLabel Whether to use the automatic label
* @param {string} blockString 'Block' label, e.g. 'Blocked (default)'. * if the default setting value is allow.
* @return {string} * @return {string}
* @private * @private
*/ */
defaultSettingString_: function( defaultSettingString_: function(defaultSetting, category, useAutomaticLabel) {
defaultSetting, askString, allowString, blockString) { if (defaultSetting == undefined || category == undefined ||
useAutomaticLabel == undefined) {
return '';
}
if (defaultSetting == settings.ContentSetting.ASK || if (defaultSetting == settings.ContentSetting.ASK ||
defaultSetting == settings.ContentSetting.IMPORTANT_CONTENT) { defaultSetting == settings.ContentSetting.IMPORTANT_CONTENT) {
return askString; return this.i18n('siteSettingsActionAskDefault');
} else if (defaultSetting == settings.ContentSetting.ALLOW) { } else if (defaultSetting == settings.ContentSetting.ALLOW) {
return allowString; if (this.useCustomSoundLabels_(category) && useAutomaticLabel)
return this.i18n('siteSettingsActionAutomaticDefault');
return this.i18n('siteSettingsActionAllowDefault');
} else if (defaultSetting == settings.ContentSetting.BLOCK) { } else if (defaultSetting == settings.ContentSetting.BLOCK) {
return blockString; if (this.useCustomSoundLabels_(category))
return this.i18n('siteSettingsActionMuteDefault');
return this.i18n('siteSettingsActionBlockDefault');
} }
assertNotReached( assertNotReached(
`No string for ${this.category}'s default of ${defaultSetting}`); `No string for ${this.category}'s default of ${defaultSetting}`);
}, },
/**
* Updates the string used for this permission category's block setting.
* @param {!settings.ContentSettingsTypes} category The permission type.
* @param {string} blockString 'Block' label.
* @param {string} muteString 'Mute' label.
* @return {string}
* @private
*/
blockSettingString_: function(category, blockString, muteString) {
if (this.useCustomSoundLabels_(category))
return muteString;
return blockString;
},
/** /**
* Returns true if there's a string to display that provides more information * Returns true if there's a string to display that provides more information
* about this permission's setting. Currently, this only gets called when * about this permission's setting. Currently, this only gets called when
......
...@@ -317,6 +317,12 @@ cr.define('settings', function() { ...@@ -317,6 +317,12 @@ cr.define('settings', function() {
*/ */
showAndroidManageAppLinks() {} showAndroidManageAppLinks() {}
// </if> // </if>
/**
* Fetches the current block autoplay state. Returns the results via
* onBlockAutoplayStatusChanged.
*/
fetchBlockAutoplayStatus() {}
} }
/** /**
...@@ -459,6 +465,11 @@ cr.define('settings', function() { ...@@ -459,6 +465,11 @@ cr.define('settings', function() {
chrome.send('showAndroidManageAppLinks'); chrome.send('showAndroidManageAppLinks');
} }
// </if> // </if>
/** @override */
fetchBlockAutoplayStatus() {
chrome.send('fetchBlockAutoplayStatus');
}
} }
// The singleton instance_ is replaced with a test version of this wrapper // The singleton instance_ is replaced with a test version of this wrapper
......
...@@ -2353,11 +2353,16 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source, ...@@ -2353,11 +2353,16 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_ASK_DEFAULT_MENU}, IDS_SETTINGS_SITE_SETTINGS_ASK_DEFAULT_MENU},
{"siteSettingsActionAllowDefault", {"siteSettingsActionAllowDefault",
IDS_SETTINGS_SITE_SETTINGS_ALLOW_DEFAULT_MENU}, IDS_SETTINGS_SITE_SETTINGS_ALLOW_DEFAULT_MENU},
{"siteSettingsActionAutomaticDefault",
IDS_SETTINGS_SITE_SETTINGS_AUTOMATIC_DEFAULT_MENU},
{"siteSettingsActionBlockDefault", {"siteSettingsActionBlockDefault",
IDS_SETTINGS_SITE_SETTINGS_BLOCK_DEFAULT_MENU}, IDS_SETTINGS_SITE_SETTINGS_BLOCK_DEFAULT_MENU},
{"siteSettingsActionMuteDefault",
IDS_SETTINGS_SITE_SETTINGS_MUTE_DEFAULT_MENU},
{"siteSettingsActionAllow", IDS_SETTINGS_SITE_SETTINGS_ALLOW_MENU}, {"siteSettingsActionAllow", IDS_SETTINGS_SITE_SETTINGS_ALLOW_MENU},
{"siteSettingsActionBlock", IDS_SETTINGS_SITE_SETTINGS_BLOCK_MENU}, {"siteSettingsActionBlock", IDS_SETTINGS_SITE_SETTINGS_BLOCK_MENU},
{"siteSettingsActionAsk", IDS_SETTINGS_SITE_SETTINGS_ASK_MENU}, {"siteSettingsActionAsk", IDS_SETTINGS_SITE_SETTINGS_ASK_MENU},
{"siteSettingsActionMute", IDS_SETTINGS_SITE_SETTINGS_MUTE_MENU},
{"siteSettingsActionReset", IDS_SETTINGS_SITE_SETTINGS_RESET_MENU}, {"siteSettingsActionReset", IDS_SETTINGS_SITE_SETTINGS_RESET_MENU},
{"siteSettingsActionSessionOnly", {"siteSettingsActionSessionOnly",
IDS_SETTINGS_SITE_SETTINGS_SESSION_ONLY_MENU}, IDS_SETTINGS_SITE_SETTINGS_SESSION_ONLY_MENU},
......
...@@ -277,6 +277,10 @@ void SiteSettingsHandler::RegisterMessages() { ...@@ -277,6 +277,10 @@ void SiteSettingsHandler::RegisterMessages() {
"setBlockAutoplayEnabled", "setBlockAutoplayEnabled",
base::BindRepeating(&SiteSettingsHandler::HandleSetBlockAutoplayEnabled, base::BindRepeating(&SiteSettingsHandler::HandleSetBlockAutoplayEnabled,
base::Unretained(this))); base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"fetchBlockAutoplayStatus",
base::BindRepeating(&SiteSettingsHandler::HandleFetchBlockAutoplayStatus,
base::Unretained(this)));
} }
void SiteSettingsHandler::OnJavascriptAllowed() { void SiteSettingsHandler::OnJavascriptAllowed() {
...@@ -1140,6 +1144,12 @@ void SiteSettingsHandler::HandleRemoveZoomLevel(const base::ListValue* args) { ...@@ -1140,6 +1144,12 @@ void SiteSettingsHandler::HandleRemoveZoomLevel(const base::ListValue* args) {
host_zoom_map->SetZoomLevelForHost(origin, default_level); host_zoom_map->SetZoomLevelForHost(origin, default_level);
} }
void SiteSettingsHandler::HandleFetchBlockAutoplayStatus(
const base::ListValue* args) {
AllowJavascript();
SendBlockAutoplayStatus();
}
void SiteSettingsHandler::SendBlockAutoplayStatus() { void SiteSettingsHandler::SendBlockAutoplayStatus() {
if (!IsJavascriptAllowed()) if (!IsJavascriptAllowed())
return; return;
......
...@@ -91,6 +91,8 @@ class SiteSettingsHandler : public SettingsPageUIHandler, ...@@ -91,6 +91,8 @@ class SiteSettingsHandler : public SettingsPageUIHandler,
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerInfobarTest, FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerInfobarTest,
SettingPermissionsTriggersInfobar); SettingPermissionsTriggersInfobar);
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, SessionOnlyException); FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, SessionOnlyException);
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest,
BlockAutoplay_SendOnRequest);
FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, BlockAutoplay_Update); FRIEND_TEST_ALL_PREFIXES(SiteSettingsHandlerTest, BlockAutoplay_Update);
// Asynchronously fetches the usage for a given origin. Replies back with // Asynchronously fetches the usage for a given origin. Replies back with
...@@ -162,6 +164,9 @@ class SiteSettingsHandler : public SettingsPageUIHandler, ...@@ -162,6 +164,9 @@ class SiteSettingsHandler : public SettingsPageUIHandler,
// Removes a particular zoom level for a given host. // Removes a particular zoom level for a given host.
void HandleRemoveZoomLevel(const base::ListValue* args); void HandleRemoveZoomLevel(const base::ListValue* args);
// Handles the request to send block autoplay state.
void HandleFetchBlockAutoplayStatus(const base::ListValue* args);
// Notifies the JS side about the state of the block autoplay toggle. // Notifies the JS side about the state of the block autoplay toggle.
void SendBlockAutoplayStatus(); void SendBlockAutoplayStatus();
......
...@@ -1264,6 +1264,14 @@ TEST_F(SiteSettingsHandlerTest, SessionOnlyException) { ...@@ -1264,6 +1264,14 @@ TEST_F(SiteSettingsHandlerTest, SessionOnlyException) {
histograms.ExpectTotalCount(uma_base + ".SessionOnly", 1); histograms.ExpectTotalCount(uma_base + ".SessionOnly", 1);
} }
TEST_F(SiteSettingsHandlerTest, BlockAutoplay_SendOnRequest) {
base::ListValue args;
handler()->HandleFetchBlockAutoplayStatus(&args);
// Check that we are checked and enabled.
ValidateBlockAutoplay(true, true);
}
TEST_F(SiteSettingsHandlerTest, BlockAutoplay_SoundSettingUpdate) { TEST_F(SiteSettingsHandlerTest, BlockAutoplay_SoundSettingUpdate) {
SetSoundContentSettingDefault(CONTENT_SETTING_BLOCK); SetSoundContentSettingDefault(CONTENT_SETTING_BLOCK);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
......
...@@ -28,6 +28,8 @@ suite('SiteDetailsPermission', function() { ...@@ -28,6 +28,8 @@ suite('SiteDetailsPermission', function() {
settings.ContentSettingsTypes.CAMERA, settings.ContentSettingsTypes.CAMERA,
[test_util.createRawSiteException('https://www.example.com')])]); [test_util.createRawSiteException('https://www.example.com')])]);
loadTimeData.overrideValues({enableBlockAutoplayContentSetting: true});
browserProxy = new TestSiteSettingsPrefsBrowserProxy(); browserProxy = new TestSiteSettingsPrefsBrowserProxy();
settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy; settings.SiteSettingsPrefsBrowserProxyImpl.instance_ = browserProxy;
PolymerTest.clearBody(); PolymerTest.clearBody();
...@@ -310,4 +312,83 @@ suite('SiteDetailsPermission', function() { ...@@ -310,4 +312,83 @@ suite('SiteDetailsPermission', function() {
assertFalse(testElement.$.permissionItem.classList.contains('two-line')); assertFalse(testElement.$.permissionItem.classList.contains('two-line'));
assertFalse(testElement.$.permission.disabled); assertFalse(testElement.$.permission.disabled);
}); });
test('sound setting default string is correct', function() {
const origin = 'https://www.example.com';
browserProxy.setPrefs(prefs);
testElement.category = settings.ContentSettingsTypes.SOUND;
testElement.label = 'Sound';
testElement.site = {
origin: origin,
embeddingOrigin: '',
setting: settings.ContentSetting.ALLOW,
source: settings.SiteSettingSource.PREFERENCE,
};
return browserProxy.whenCalled('getDefaultValueForContentType')
.then((args) => {
// Check getDefaultValueForContentType was called for sound category.
assertEquals(settings.ContentSettingsTypes.SOUND, args);
// The default option will always be the first in the menu.
assertEquals(
'Allow (default)', testElement.$.permission.options[0].text,
'Default setting string should match prefs');
browserProxy.resetResolver('getDefaultValueForContentType');
const defaultPrefs = test_util.createSiteSettingsPrefs(
[test_util.createContentSettingTypeToValuePair(
settings.ContentSettingsTypes.SOUND,
test_util.createDefaultContentSetting(
{setting: settings.ContentSetting.BLOCK}))],
[]);
browserProxy.setPrefs(defaultPrefs);
return browserProxy.whenCalled('getDefaultValueForContentType');
})
.then((args) => {
assertEquals(settings.ContentSettingsTypes.SOUND, args);
assertEquals(
'Mute (default)', testElement.$.permission.options[0].text,
'Default setting string should match prefs');
browserProxy.resetResolver('getDefaultValueForContentType');
testElement.useAutomaticLabel = true;
const defaultPrefs = test_util.createSiteSettingsPrefs(
[test_util.createContentSettingTypeToValuePair(
settings.ContentSettingsTypes.SOUND,
test_util.createDefaultContentSetting(
{setting: settings.ContentSetting.ALLOW}))],
[]);
browserProxy.setPrefs(defaultPrefs);
return browserProxy.whenCalled('getDefaultValueForContentType');
})
.then((args) => {
assertEquals(settings.ContentSettingsTypes.SOUND, args);
assertEquals(
'Automatic (default)', testElement.$.permission.options[0].text,
'Default setting string should match prefs');
});
});
test('sound setting block string is correct', function() {
const origin = 'https://www.example.com';
browserProxy.setPrefs(prefs);
testElement.category = settings.ContentSettingsTypes.SOUND;
testElement.label = 'Sound';
testElement.site = {
origin: origin,
embeddingOrigin: '',
setting: settings.ContentSetting.ALLOW,
source: settings.SiteSettingSource.PREFERENCE,
};
return browserProxy.whenCalled('getDefaultValueForContentType')
.then((args) => {
// Check getDefaultValueForContentType was called for sound category.
assertEquals(settings.ContentSettingsTypes.SOUND, args);
// The block option will always be the third in the menu.
assertEquals(
'Mute', testElement.$.permission.options[2].text,
'Block setting string should match prefs');
});
});
}); });
...@@ -443,4 +443,12 @@ suite('SiteDetails', function() { ...@@ -443,4 +443,12 @@ suite('SiteDetails', function() {
}); });
}); });
test('call fetch block autoplay status', function() {
const origin = 'https://foo.com:443';
browserProxy.setPrefs(prefs);
loadTimeData.overrideValues({enableSiteSettings: true});
testElement = createSiteDetails(origin);
return browserProxy.whenCalled('fetchBlockAutoplayStatus');
});
}); });
...@@ -44,6 +44,7 @@ class TestSiteSettingsPrefsBrowserProxy extends TestBrowserProxy { ...@@ -44,6 +44,7 @@ class TestSiteSettingsPrefsBrowserProxy extends TestBrowserProxy {
'setOriginPermissions', 'setOriginPermissions',
'setProtocolDefault', 'setProtocolDefault',
'updateIncognitoStatus', 'updateIncognitoStatus',
'fetchBlockAutoplayStatus',
]); ]);
/** @private {boolean} */ /** @private {boolean} */
...@@ -386,4 +387,9 @@ class TestSiteSettingsPrefsBrowserProxy extends TestBrowserProxy { ...@@ -386,4 +387,9 @@ class TestSiteSettingsPrefsBrowserProxy extends TestBrowserProxy {
updateIncognitoStatus() { updateIncognitoStatus() {
this.methodCalled('updateIncognitoStatus', arguments); this.methodCalled('updateIncognitoStatus', arguments);
} }
/** @override */
fetchBlockAutoplayStatus() {
this.methodCalled('fetchBlockAutoplayStatus');
}
} }
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