Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1682)

Unified Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view_unittest.cc

Issue 2725783004: views: align columns in site settings dialog (Closed)
Patch Set: fix unit tests, document stuff Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6b6db780ed0ba1f45424f1244560baabdb29c057..b8ce7bd836f11393587eee0afb05460a9356a5dc 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
@@ -57,12 +57,18 @@ class WebsiteSettingsPopupViewTestApi {
PermissionSelectorRow* GetPermissionSelectorAt(int index) {
return static_cast<PermissionSelectorRow*>(
- permissions_view()->child_at(index));
+ view_->selector_rows_.at(index).get());
+ }
+
+ base::string16 GetPermissionLabelTextAt(int index) {
+ views::View* view = GetPermissionSelectorAt(index)->label_;
+ if (view->GetClassName() == views::Label::kViewClassName)
+ return static_cast<views::Label*>(view)->text();
+ return base::string16();
}
base::string16 GetPermissionButtonTextAt(int index) {
- const int kButtonIndex = 2; // Button should be the third child.
- views::View* view = GetPermissionSelectorAt(index)->child_at(kButtonIndex);
+ views::View* view = GetPermissionSelectorAt(index)->button();
if (view->GetClassName() == views::MenuButton::kViewClassName) {
return static_cast<views::MenuButton*>(view)->GetText();
} else if (view->GetClassName() == views::Combobox::kViewClassName) {
@@ -175,7 +181,7 @@ TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
list.back().setting = CONTENT_SETTING_DEFAULT;
const int kExpectedChildren =
- ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 11 : 13;
+ 3 * (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 11 : 13);
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
list.back().setting = CONTENT_SETTING_ALLOW;
@@ -183,15 +189,10 @@ TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
PermissionSelectorRow* selector = api_->GetPermissionSelectorAt(0);
- EXPECT_EQ(3, selector->child_count());
+ EXPECT_NE(nullptr, selector);
// Verify labels match the settings on the PermissionInfoList.
- const int kLabelIndex = 1;
- EXPECT_EQ(views::Label::kViewClassName,
- selector->child_at(kLabelIndex)->GetClassName());
- views::Label* label =
- static_cast<views::Label*>(selector->child_at(kLabelIndex));
- EXPECT_EQ(base::ASCIIToUTF16("Location"), label->text());
+ EXPECT_EQ(base::ASCIIToUTF16("Location"), api_->GetPermissionLabelTextAt(0));
EXPECT_EQ(base::ASCIIToUTF16("Allow"), api_->GetPermissionButtonTextAt(0));
// Verify calling SetPermisisonInfo() directly updates the UI.
@@ -221,7 +222,7 @@ TEST_F(WebsiteSettingsPopupViewTest, MAYBE_SetPermissionInfo) {
// Test UI construction and reconstruction with USB devices.
TEST_F(WebsiteSettingsPopupViewTest, SetPermissionInfoWithUsbDevice) {
const int kExpectedChildren =
- ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 11 : 13;
+ 3 * (ExclusiveAccessManager::IsSimplifiedFullscreenUIEnabled() ? 11 : 13);
EXPECT_EQ(kExpectedChildren, api_->permissions_view()->child_count());
const GURL origin = GURL(kUrl).GetOrigin();

Powered by Google App Engine
This is Rietveld 408576698