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

Unified Diff: ui/message_center/views/notification_view_unittest.cc

Issue 305633004: Puts notification buttons back below the image (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved the test. Created 6 years, 7 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
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/notification_view_unittest.cc
diff --git a/ui/message_center/views/notification_view_unittest.cc b/ui/message_center/views/notification_view_unittest.cc
index 596e9ae792829e27cb78fddbb808464bcc9b7e70..b6d67526905cfbf380fea2fcfb9e19ced3de8d41 100644
--- a/ui/message_center/views/notification_view_unittest.cc
+++ b/ui/message_center/views/notification_view_unittest.cc
@@ -66,6 +66,34 @@ class NotificationViewTest : public views::ViewsTestBase,
return std::vector<ButtonInfo>(number, info);
}
+ void CheckVerticalOrderInNotification() {
+ std::vector<views::View*> vertical_order;
+ vertical_order.push_back(notification_view()->top_view_);
+ vertical_order.push_back(notification_view()->image_view_);
+ std::copy(notification_view()->action_buttons_.begin(),
+ notification_view()->action_buttons_.end(),
+ std::back_inserter(vertical_order));
+ std::vector<views::View*>::iterator current = vertical_order.begin();
+ std::vector<views::View*>::iterator last = current++;
+ while (current != vertical_order.end()) {
+ gfx::Point last_point = (*last)->bounds().origin();
+ views::View::ConvertPointToTarget(
+ (*last), notification_view(), &last_point);
+
+ gfx::Point current_point = (*current)->bounds().origin();
robliao 2014/05/30 01:19:33 This was CenterPoint before. Is origin a better me
dewittj 2014/06/02 18:00:05 It was easier for me to verify that they were in r
+ views::View::ConvertPointToTarget(
+ (*current), notification_view(), &current_point);
+
+ EXPECT_LT(last_point.y(), current_point.y());
+ last = current++;
+ }
+ }
+
+ void UpdateNotificationViews() {
+ notification_view()->CreateOrUpdateViews(*notification());
+ notification_view()->Layout();
+ }
+
private:
scoped_ptr<RichNotificationData> data_;
scoped_ptr<Notification> notification_;
@@ -277,4 +305,19 @@ TEST_F(NotificationViewTest, UpdateButtonCountTest) {
EXPECT_TRUE(NULL == notification_view()->action_buttons_[0]->background());
}
+TEST_F(NotificationViewTest, ViewOrderingTest) {
+ // Tests that views are created in the correct vertical order.
+ notification()->set_buttons(CreateButtons(2));
+
+ // Layout the initial views.
+ UpdateNotificationViews();
+
+ // Double-check that vertical order is correct.
+ CheckVerticalOrderInNotification();
+
+ // Tests that views remain in that order even after an update.
+ UpdateNotificationViews();
+ CheckVerticalOrderInNotification();
+}
+
} // namespace message_center
« no previous file with comments | « ui/message_center/views/notification_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698