| 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
|
|
|