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

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

Issue 273173003: Notifications: Retain button hover state during content updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 0ca8e0a389044cbd6773de4a8132d47ac596ec51..f783a3c877aa5794deff47f240ce9a3c4d1e8f42 100644
--- a/ui/message_center/views/notification_view_unittest.cc
+++ b/ui/message_center/views/notification_view_unittest.cc
@@ -13,6 +13,7 @@
#include "ui/message_center/notification_list.h"
#include "ui/message_center/notification_types.h"
#include "ui/message_center/views/message_center_controller.h"
+#include "ui/message_center/views/notification_button.h"
namespace message_center {
@@ -55,6 +56,12 @@ class NotificationViewTest : public testing::Test,
return bitmap;
}
+ std::vector<ButtonInfo> CreateButtons(int number) {
+ ButtonInfo info(base::ASCIIToUTF16("Test button title."));
+ info.icon = CreateTestImage(4, 4);
+ return std::vector<ButtonInfo>(number, info);
+ }
+
private:
scoped_ptr<RichNotificationData> data_;
scoped_ptr<Notification> notification_;
@@ -175,4 +182,32 @@ TEST_F(NotificationViewTest, TestLineLimits) {
EXPECT_EQ(0, notification_view()->GetMessageLineLimit(2, 360));
}
+TEST_F(NotificationViewTest, UpdateButtonsStateTest) {
+ notification()->set_buttons(CreateButtons(2));
+ notification_view()->CreateOrUpdateViews(*notification());
+ notification_view()->action_buttons_[0]->set_animate_on_state_change(false);
+ notification_view()->action_buttons_[1]->set_animate_on_state_change(false);
+
+ EXPECT_TRUE(NULL == notification_view()->action_buttons_[0]->background());
+
+ notification_view()->action_buttons_[0]->SetState(
+ views::Button::STATE_HOVERED);
+
+ EXPECT_TRUE(NULL != notification_view()->action_buttons_[0]->background());
+
+ notification_view()->CreateOrUpdateViews(*notification());
+ notification_view()->action_buttons_[0]->set_animate_on_state_change(false);
+ notification_view()->action_buttons_[1]->set_animate_on_state_change(false);
+
+ EXPECT_TRUE(NULL != notification_view()->action_buttons_[0]->background());
+
+ notification_view()->action_buttons_[0]->SetState(
+ views::Button::STATE_NORMAL);
+
+ notification_view()->CreateOrUpdateViews(*notification());
+
+ EXPECT_TRUE(NULL == notification_view()->action_buttons_[0]->background());
+
+}
+
} // namespace message_center
« ui/message_center/views/notification_view.cc ('K') | « 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