Chromium Code Reviews| Index: chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc |
| diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc |
| index 716c00164760fa4949ffb0a0569c78f6cfa39995..7b32d1eb2738e1f1f2588c04767e0bd86944380b 100644 |
| --- a/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc |
| +++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc |
| @@ -164,11 +164,18 @@ TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfo) { |
| list.back().source = content_settings::SETTING_SOURCE_USER; |
| list.back().is_incognito = false; |
| - EXPECT_EQ(0, api_->permissions_content()->child_count()); |
| +#ifdef OS_MACOSX |
| + // Mac OS X still has Fullscreen and Mouse Lock permissions. |
|
tapted
2016/03/06 23:02:08
This is actually in a fieldtrial on Mac, to catch
palmer
2016/03/09 20:13:07
OK, I've changed the tests to use ExclusiveAccessM
|
| + const int kExpectedChildren = 12; |
| +#else |
| + const int kExpectedChildren = 10; |
| +#endif |
| + |
| + EXPECT_EQ(kExpectedChildren, api_->permissions_content()->child_count()); |
| list.back().setting = CONTENT_SETTING_ALLOW; |
| api_->SetPermissionInfo(list); |
| - EXPECT_EQ(1, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(kExpectedChildren, api_->permissions_content()->child_count()); |
| PermissionSelectorView* selector = api_->GetPermissionSelectorAt(0); |
| EXPECT_EQ(3, selector->child_count()); |
| @@ -193,26 +200,26 @@ TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfo) { |
| // WebsiteSettings to update the pref. |
| list.back().setting = CONTENT_SETTING_ALLOW; |
| api_->GetPermissionSelectorAt(0)->PermissionChanged(list.back()); |
| - EXPECT_EQ(1, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(kExpectedChildren, api_->permissions_content()->child_count()); |
| EXPECT_EQ(base::ASCIIToUTF16("Allowed by you"), |
| api_->GetPermissionButtonAt(0)->GetText()); |
| // Setting to the default via the UI should keep the button around. |
| list.back().setting = CONTENT_SETTING_ASK; |
| api_->GetPermissionSelectorAt(0)->PermissionChanged(list.back()); |
| - EXPECT_EQ(1, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(kExpectedChildren, api_->permissions_content()->child_count()); |
| EXPECT_EQ(base::ASCIIToUTF16("Ask by you"), |
| api_->GetPermissionButtonAt(0)->GetText()); |
| // However, since the setting is now default, recreating the dialog with those |
| // settings should omit the permission from the UI. |
| api_->SetPermissionInfo(list); |
| - EXPECT_EQ(0, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(kExpectedChildren, api_->permissions_content()->child_count()); |
| } |
| // Test UI construction and reconstruction with USB devices. |
| TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfoWithUsbDevice) { |
| - EXPECT_EQ(0, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(10, api_->permissions_content()->child_count()); |
| const GURL origin = GURL(kUrl).GetOrigin(); |
| scoped_refptr<device::UsbDevice> device = |
| @@ -224,10 +231,10 @@ TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfoWithUsbDevice) { |
| PermissionInfoList list; |
| api_->SetPermissionInfo(list); |
| - EXPECT_EQ(1, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(11, api_->permissions_content()->child_count()); |
| ChosenObjectView* object_view = |
| - static_cast<ChosenObjectView*>(api_->permissions_content()->child_at(0)); |
| + static_cast<ChosenObjectView*>(api_->permissions_content()->child_at(10)); |
| EXPECT_EQ(3, object_view->child_count()); |
| const int kLabelIndex = 1; |
| @@ -245,7 +252,7 @@ TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfoWithUsbDevice) { |
| static_cast<views::ButtonListener*>(object_view); |
| button_listener->ButtonPressed(button, event); |
| api_->SetPermissionInfo(list); |
| - EXPECT_EQ(0, api_->permissions_content()->child_count()); |
| + EXPECT_EQ(10, api_->permissions_content()->child_count()); |
| EXPECT_FALSE(store->HasDevicePermission( |
| origin, origin, *device::usb::DeviceInfo::From(*device))); |
| } |