Commit d7c4d54d authored by Patti's avatar Patti Committed by Commit Bot

Page Info Desktop: Always show the Flash permission.

Show the Flash permission always on desktop Page Info.

Bug: 791142
Change-Id: I42dd4e856ce0818cea9905e36669a74cc54a6f98
Reviewed-on: https://chromium-review.googlesource.com/809987
Commit-Queue: Patti <patricialor@chromium.org>
Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522281}
parent 9b2966b8
...@@ -181,6 +181,10 @@ bool ShouldShowPermission( ...@@ -181,6 +181,10 @@ bool ShouldShowPermission(
// gets checked there regardless of default setting on Desktop. // gets checked there regardless of default setting on Desktop.
if (info.type == CONTENT_SETTINGS_TYPE_GEOLOCATION) if (info.type == CONTENT_SETTINGS_TYPE_GEOLOCATION)
return true; return true;
#else
// Flash will always be shown. See https://crbug.com/791142.
if (info.type == CONTENT_SETTINGS_TYPE_PLUGINS)
return true;
#endif #endif
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
......
...@@ -213,25 +213,34 @@ bool PermissionInfoListContainsPermission(const PermissionInfoList& permissions, ...@@ -213,25 +213,34 @@ bool PermissionInfoListContainsPermission(const PermissionInfoList& permissions,
TEST_F(PageInfoTest, NonFactoryDefaultAndRecentlyChangedPermissionsShown) { TEST_F(PageInfoTest, NonFactoryDefaultAndRecentlyChangedPermissionsShown) {
page_info()->PresentSitePermissions(); page_info()->PresentSitePermissions();
// By default, the number of permissions shown should be 0, except on Android, std::vector<ContentSettingsType> expected_visible_permissions;
// where Geolocation needs to be checked for DSE settings.
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// Geolocation is always allowed to pass through to Android-specific logic to
// check for DSE settings (so expect 1 item), but isn't actually shown later
// on because this test isn't testing with a default search engine origin.
EXPECT_EQ(1uL, last_permission_info_list().size()); EXPECT_EQ(1uL, last_permission_info_list().size());
EXPECT_EQ(CONTENT_SETTINGS_TYPE_GEOLOCATION,
last_permission_info_list().back().type);
#else #else
EXPECT_EQ(0uL, last_permission_info_list().size()); expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_PLUGINS);
// Flash is always visible on desktop - see https://crbug.com/791142.
EXPECT_EQ(expected_visible_permissions.size(),
last_permission_info_list().size());
EXPECT_EQ(CONTENT_SETTINGS_TYPE_PLUGINS,
last_permission_info_list().back().type);
#endif #endif
std::vector<ContentSettingsType> expected_visible_permissions = {
CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
};
// Change some default-ask settings away from the default. // Change some default-ask settings away from the default.
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION, page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
CONTENT_SETTING_ALLOW); CONTENT_SETTING_ALLOW);
expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_GEOLOCATION);
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
CONTENT_SETTING_ALLOW); CONTENT_SETTING_ALLOW);
expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, page_info()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
CONTENT_SETTING_ALLOW); CONTENT_SETTING_ALLOW);
expected_visible_permissions.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
EXPECT_EQ(expected_visible_permissions.size(), EXPECT_EQ(expected_visible_permissions.size(),
last_permission_info_list().size()); last_permission_info_list().size());
......
...@@ -221,11 +221,12 @@ TEST_F(PageInfoBubbleViewTest, SetPermissionInfo) { ...@@ -221,11 +221,12 @@ TEST_F(PageInfoBubbleViewTest, SetPermissionInfo) {
list.back().is_incognito = false; list.back().is_incognito = false;
list.back().setting = CONTENT_SETTING_BLOCK; list.back().setting = CONTENT_SETTING_BLOCK;
// Initially, no permissions are shown because they are all set to default. // Initially, no permissions are shown because they are all set to default,
int num_expected_children = 0; // except for Flash.
int num_expected_children = 3;
EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count()); EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count());
num_expected_children = kViewsPerPermissionRow * list.size(); num_expected_children += kViewsPerPermissionRow * list.size();
list.back().setting = CONTENT_SETTING_ALLOW; list.back().setting = CONTENT_SETTING_ALLOW;
api_->SetPermissionInfo(list); api_->SetPermissionInfo(list);
EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count()); EXPECT_EQ(num_expected_children, api_->permissions_view()->child_count());
...@@ -279,7 +280,8 @@ TEST_F(PageInfoBubbleViewTest, SetPermissionInfo) { ...@@ -279,7 +280,8 @@ TEST_F(PageInfoBubbleViewTest, SetPermissionInfo) {
// Test UI construction and reconstruction with USB devices. // Test UI construction and reconstruction with USB devices.
TEST_F(PageInfoBubbleViewTest, SetPermissionInfoWithUsbDevice) { TEST_F(PageInfoBubbleViewTest, SetPermissionInfoWithUsbDevice) {
const int kExpectedChildren = 0; // One permission row is always shown here (Flash). https://crbug.com/791142
const int kExpectedChildren = kViewsPerPermissionRow;
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count()); EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
const GURL origin = GURL(kUrl).GetOrigin(); const GURL origin = GURL(kUrl).GetOrigin();
......
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