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

Side by Side Diff: ui/message_center/views/message_center_view_unittest.cc

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/message_center_view.h" 5 #include "ui/message_center/views/message_center_view.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/message_center/fake_message_center.h" 15 #include "ui/message_center/fake_message_center.h"
16 #include "ui/message_center/message_center_style.h" 16 #include "ui/message_center/message_center_style.h"
17 #include "ui/message_center/notification.h" 17 #include "ui/message_center/notification.h"
18 #include "ui/message_center/notification_list.h" 18 #include "ui/message_center/notification_list.h"
19 #include "ui/message_center/notification_types.h" 19 #include "ui/message_center/notification_types.h"
20 #include "ui/message_center/views/message_center_button_bar.h"
20 #include "ui/message_center/views/message_center_controller.h" 21 #include "ui/message_center/views/message_center_controller.h"
21 #include "ui/message_center/views/message_list_view.h" 22 #include "ui/message_center/views/message_list_view.h"
22 #include "ui/message_center/views/notification_view.h" 23 #include "ui/message_center/views/notification_view.h"
24 #include "ui/views/controls/slide_out_view.h"
23 25
24 namespace message_center { 26 namespace message_center {
25 27
26 static const char* kNotificationId1 = "notification id 1"; 28 static const char* kNotificationId1 = "notification id 1";
27 static const char* kNotificationId2 = "notification id 2"; 29 static const char* kNotificationId2 = "notification id 2";
28 30
29 /* Types **********************************************************************/ 31 /* Types **********************************************************************/
30 32
31 enum CallType { 33 enum CallType {
32 GET_PREFERRED_SIZE, 34 GET_PREFERRED_SIZE,
33 GET_HEIGHT_FOR_WIDTH, 35 GET_HEIGHT_FOR_WIDTH,
34 LAYOUT 36 LAYOUT
35 }; 37 };
36 38
39 class DummyEvent : public ui::Event {
40 public:
41 DummyEvent() : Event(ui::ET_UNKNOWN, base::TimeDelta(), 0) {}
42 ~DummyEvent() override {}
43 };
44
37 /* Instrumented/Mock NotificationView subclass ********************************/ 45 /* Instrumented/Mock NotificationView subclass ********************************/
38 46
39 class MockNotificationView : public NotificationView { 47 class MockNotificationView : public NotificationView {
40 public: 48 public:
41 class Test { 49 class Test {
42 public: 50 public:
43 virtual void RegisterCall(CallType type) = 0; 51 virtual void RegisterCall(CallType type) = 0;
44 }; 52 };
45 53
46 explicit MockNotificationView(MessageCenterController* controller, 54 explicit MockNotificationView(MessageCenterController* controller,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 95 }
88 96
89 class FakeMessageCenterImpl : public FakeMessageCenter { 97 class FakeMessageCenterImpl : public FakeMessageCenter {
90 public: 98 public:
91 const NotificationList::Notifications& GetVisibleNotifications() override { 99 const NotificationList::Notifications& GetVisibleNotifications() override {
92 return visible_notifications_; 100 return visible_notifications_;
93 } 101 }
94 void SetVisibleNotifications(NotificationList::Notifications notifications) { 102 void SetVisibleNotifications(NotificationList::Notifications notifications) {
95 visible_notifications_ = notifications; 103 visible_notifications_ = notifications;
96 } 104 }
105 void RemoveAllClosableNotifications(bool by_user) override {
106 remove_all_closable_notification_called_ = true;
107 }
108 bool remove_all_closable_notification_called_ = false;
97 NotificationList::Notifications visible_notifications_; 109 NotificationList::Notifications visible_notifications_;
98 }; 110 };
99 111
100 /* Test fixture ***************************************************************/ 112 /* Test fixture ***************************************************************/
101 113
102 class MessageCenterViewTest : public testing::Test, 114 class MessageCenterViewTest : public testing::Test,
103 public MockNotificationView::Test, 115 public MockNotificationView::Test,
104 public MessageCenterController { 116 public MessageCenterController {
105 public: 117 public:
106 MessageCenterViewTest(); 118 MessageCenterViewTest();
107 ~MessageCenterViewTest() override; 119 ~MessageCenterViewTest() override;
108 120
109 void SetUp() override; 121 void SetUp() override;
110 void TearDown() override; 122 void TearDown() override;
111 123
112 MessageCenterView* GetMessageCenterView(); 124 MessageCenterView* GetMessageCenterView();
113 MessageListView* GetMessageListView(); 125 MessageListView* GetMessageListView();
126 FakeMessageCenterImpl* GetMessageCenter() const;
114 NotificationView* GetNotificationView(const std::string& id); 127 NotificationView* GetNotificationView(const std::string& id);
115 views::BoundsAnimator* GetAnimator(); 128 views::BoundsAnimator* GetAnimator();
116 int GetNotificationCount(); 129 int GetNotificationCount();
117 int GetCallCount(CallType type); 130 int GetCallCount(CallType type);
118 int GetCalculatedMessageListViewHeight(); 131 int GetCalculatedMessageListViewHeight();
119 void AddNotification(scoped_ptr<Notification> notification); 132 void AddNotification(scoped_ptr<Notification> notification);
120 void UpdateNotification(const std::string& notification_id, 133 void UpdateNotification(const std::string& notification_id,
121 scoped_ptr<Notification> notification); 134 scoped_ptr<Notification> notification);
122 135
123 // Overridden from MessageCenterController: 136 // Overridden from MessageCenterController:
124 void ClickOnNotification(const std::string& notification_id) override; 137 void ClickOnNotification(const std::string& notification_id) override;
125 void RemoveNotification(const std::string& notification_id, 138 void RemoveNotification(const std::string& notification_id,
126 bool by_user) override; 139 bool by_user) override;
127 scoped_ptr<ui::MenuModel> CreateMenuModel( 140 scoped_ptr<ui::MenuModel> CreateMenuModel(
128 const NotifierId& notifier_id, 141 const NotifierId& notifier_id,
129 const base::string16& display_source) override; 142 const base::string16& display_source) override;
130 bool HasClickedListener(const std::string& notification_id) override; 143 bool HasClickedListener(const std::string& notification_id) override;
131 void ClickOnNotificationButton(const std::string& notification_id, 144 void ClickOnNotificationButton(const std::string& notification_id,
132 int button_index) override; 145 int button_index) override;
133 void ClickOnSettingsButton(const std::string& notification_id) override; 146 void ClickOnSettingsButton(const std::string& notification_id) override;
134 147
135 // Overridden from MockNotificationView::Test 148 // Overridden from MockNotificationView::Test
136 void RegisterCall(CallType type) override; 149 void RegisterCall(CallType type) override;
137 150
138 void FireOnMouseExitedEvent(); 151 void FireOnMouseExitedEvent();
139 152
140 void LogBounds(int depth, views::View* view); 153 void LogBounds(int depth, views::View* view);
141 154
155 MessageCenterButtonBar* GetButtonBar() const;
156
142 private: 157 private:
143 views::View* MakeParent(views::View* child1, views::View* child2); 158 views::View* MakeParent(views::View* child1, views::View* child2);
144 159
145 base::MessageLoopForUI message_loop_; 160 base::MessageLoopForUI message_loop_;
146 161
147 NotificationList::Notifications notifications_; 162 NotificationList::Notifications notifications_;
148 scoped_ptr<MessageCenterView> message_center_view_; 163 scoped_ptr<MessageCenterView> message_center_view_;
149 FakeMessageCenterImpl message_center_; 164 scoped_ptr<FakeMessageCenterImpl> message_center_;
150 std::map<CallType,int> callCounts_; 165 std::map<CallType,int> callCounts_;
151 166
152 DISALLOW_COPY_AND_ASSIGN(MessageCenterViewTest); 167 DISALLOW_COPY_AND_ASSIGN(MessageCenterViewTest);
153 }; 168 };
154 169
155 MessageCenterViewTest::MessageCenterViewTest() { 170 MessageCenterViewTest::MessageCenterViewTest() {
156 } 171 }
157 172
158 MessageCenterViewTest::~MessageCenterViewTest() { 173 MessageCenterViewTest::~MessageCenterViewTest() {
159 } 174 }
160 175
161 void MessageCenterViewTest::SetUp() { 176 void MessageCenterViewTest::SetUp() {
177 message_center_.reset(new FakeMessageCenterImpl());
178
162 // Create a dummy notification. 179 // Create a dummy notification.
163 Notification* notification1 = new Notification( 180 Notification* notification1 = new Notification(
164 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId1), 181 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId1),
165 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message1"), gfx::Image(), 182 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message1"), gfx::Image(),
166 base::UTF8ToUTF16("display source"), GURL(), 183 base::UTF8ToUTF16("display source"), GURL(),
167 NotifierId(NotifierId::APPLICATION, "extension_id"), 184 NotifierId(NotifierId::APPLICATION, "extension_id"),
168 message_center::RichNotificationData(), NULL); 185 message_center::RichNotificationData(), NULL);
169 186
170 Notification* notification2 = new Notification( 187 Notification* notification2 = new Notification(
171 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2), 188 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2),
172 base::UTF8ToUTF16("title2"), base::UTF8ToUTF16("message2"), gfx::Image(), 189 base::UTF8ToUTF16("title2"), base::UTF8ToUTF16("message2"), gfx::Image(),
173 base::UTF8ToUTF16("display source"), GURL(), 190 base::UTF8ToUTF16("display source"), GURL(),
174 NotifierId(NotifierId::APPLICATION, "extension_id"), 191 NotifierId(NotifierId::APPLICATION, "extension_id"),
175 message_center::RichNotificationData(), NULL); 192 message_center::RichNotificationData(), NULL);
176 193
177 // ...and a list for it. 194 // ...and a list for it.
178 notifications_.insert(notification1); 195 notifications_.insert(notification1);
179 notifications_.insert(notification2); 196 notifications_.insert(notification2);
180 message_center_.SetVisibleNotifications(notifications_); 197 message_center_->SetVisibleNotifications(notifications_);
181 198
182 // Then create a new MessageCenterView with that single notification. 199 // Then create a new MessageCenterView with that single notification.
183 base::string16 title; 200 base::string16 title;
184 message_center_view_.reset(new MessageCenterView( 201 message_center_view_.reset(new MessageCenterView(
185 &message_center_, NULL, 100, false, /*top_down =*/false, title)); 202 message_center_.get(), NULL, 100, false, /*top_down =*/false, title));
186 GetMessageListView()->quit_message_loop_after_animation_for_test_ = true; 203 GetMessageListView()->quit_message_loop_after_animation_for_test_ = true;
187 GetMessageCenterView()->SetBounds(0, 0, 380, 600); 204 GetMessageCenterView()->SetBounds(0, 0, 380, 600);
188 message_center_view_->SetNotifications(notifications_); 205 message_center_view_->SetNotifications(notifications_);
189 206
190 // Wait until the animation finishes if available. 207 // Wait until the animation finishes if available.
191 if (GetAnimator()->IsAnimating()) 208 if (GetAnimator()->IsAnimating())
192 base::MessageLoop::current()->Run(); 209 base::MessageLoop::current()->Run();
193 } 210 }
194 211
195 void MessageCenterViewTest::TearDown() { 212 void MessageCenterViewTest::TearDown() {
196 message_center_view_.reset(); 213 message_center_view_.reset();
197 STLDeleteElements(&notifications_); 214 STLDeleteElements(&notifications_);
198 } 215 }
199 216
200 MessageCenterView* MessageCenterViewTest::GetMessageCenterView() { 217 MessageCenterView* MessageCenterViewTest::GetMessageCenterView() {
201 return message_center_view_.get(); 218 return message_center_view_.get();
202 } 219 }
203 220
204 MessageListView* MessageCenterViewTest::GetMessageListView() { 221 MessageListView* MessageCenterViewTest::GetMessageListView() {
205 return message_center_view_->message_list_view_.get(); 222 return message_center_view_->message_list_view_.get();
206 } 223 }
207 224
225 FakeMessageCenterImpl* MessageCenterViewTest::GetMessageCenter() const {
226 return message_center_.get();
227 }
228
208 NotificationView* MessageCenterViewTest::GetNotificationView( 229 NotificationView* MessageCenterViewTest::GetNotificationView(
209 const std::string& id) { 230 const std::string& id) {
210 return message_center_view_->notification_views_[id]; 231 return message_center_view_->notification_views_[id];
211 } 232 }
212 233
213 int MessageCenterViewTest::GetCalculatedMessageListViewHeight() { 234 int MessageCenterViewTest::GetCalculatedMessageListViewHeight() {
214 return GetMessageListView()->GetHeightForWidth(GetMessageListView()->width()); 235 return GetMessageListView()->GetHeightForWidth(GetMessageListView()->width());
215 } 236 }
216 237
217 views::BoundsAnimator* MessageCenterViewTest::GetAnimator() { 238 views::BoundsAnimator* MessageCenterViewTest::GetAnimator() {
(...skipping 11 matching lines...) Expand all
229 void MessageCenterViewTest::ClickOnNotification( 250 void MessageCenterViewTest::ClickOnNotification(
230 const std::string& notification_id) { 251 const std::string& notification_id) {
231 // For this test, this method should not be invoked. 252 // For this test, this method should not be invoked.
232 NOTREACHED(); 253 NOTREACHED();
233 } 254 }
234 255
235 void MessageCenterViewTest::AddNotification( 256 void MessageCenterViewTest::AddNotification(
236 scoped_ptr<Notification> notification) { 257 scoped_ptr<Notification> notification) {
237 std::string notification_id = notification->id(); 258 std::string notification_id = notification->id();
238 notifications_.insert(notification.release()); 259 notifications_.insert(notification.release());
239 message_center_.SetVisibleNotifications(notifications_); 260 message_center_->SetVisibleNotifications(notifications_);
240 message_center_view_->OnNotificationAdded(notification_id); 261 message_center_view_->OnNotificationAdded(notification_id);
241 } 262 }
242 263
243 void MessageCenterViewTest::UpdateNotification( 264 void MessageCenterViewTest::UpdateNotification(
244 const std::string& notification_id, 265 const std::string& notification_id,
245 scoped_ptr<Notification> notification) { 266 scoped_ptr<Notification> notification) {
246 for (auto it = notifications_.begin(); it != notifications_.end(); it++) { 267 for (auto it = notifications_.begin(); it != notifications_.end(); it++) {
247 if ((*it)->id() == notification_id) { 268 if ((*it)->id() == notification_id) {
248 delete *it; 269 delete *it;
249 notifications_.erase(it); 270 notifications_.erase(it);
250 break; 271 break;
251 } 272 }
252 } 273 }
253 // |notifications| is a "set" container so we don't need to be aware the 274 // |notifications| is a "set" container so we don't need to be aware the
254 // order. 275 // order.
255 notifications_.insert(notification.release()); 276 notifications_.insert(notification.release());
256 message_center_.SetVisibleNotifications(notifications_); 277 message_center_->SetVisibleNotifications(notifications_);
257 message_center_view_->OnNotificationUpdated(notification_id); 278 message_center_view_->OnNotificationUpdated(notification_id);
258 } 279 }
259 280
260 void MessageCenterViewTest::RemoveNotification( 281 void MessageCenterViewTest::RemoveNotification(
261 const std::string& notification_id, 282 const std::string& notification_id,
262 bool by_user) { 283 bool by_user) {
263 for (auto it = notifications_.begin(); it != notifications_.end(); it++) { 284 for (auto it = notifications_.begin(); it != notifications_.end(); it++) {
264 if ((*it)->id() == notification_id) { 285 if ((*it)->id() == notification_id) {
265 delete *it; 286 delete *it;
266 notifications_.erase(it); 287 notifications_.erase(it);
267 break; 288 break;
268 } 289 }
269 } 290 }
270 message_center_.SetVisibleNotifications(notifications_); 291 message_center_->SetVisibleNotifications(notifications_);
271 message_center_view_->OnNotificationRemoved(notification_id, by_user); 292 message_center_view_->OnNotificationRemoved(notification_id, by_user);
272 } 293 }
273 294
274 scoped_ptr<ui::MenuModel> MessageCenterViewTest::CreateMenuModel( 295 scoped_ptr<ui::MenuModel> MessageCenterViewTest::CreateMenuModel(
275 const NotifierId& notifier_id, 296 const NotifierId& notifier_id,
276 const base::string16& display_source) { 297 const base::string16& display_source) {
277 // For this test, this method should not be invoked. 298 // For this test, this method should not be invoked.
278 NOTREACHED(); 299 NOTREACHED();
279 return nullptr; 300 return nullptr;
280 } 301 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 base::string16 inset; 336 base::string16 inset;
316 for (int i = 0; i < depth; ++i) 337 for (int i = 0; i < depth; ++i)
317 inset.append(base::UTF8ToUTF16(" ")); 338 inset.append(base::UTF8ToUTF16(" "));
318 gfx::Rect bounds = view->bounds(); 339 gfx::Rect bounds = view->bounds();
319 DVLOG(0) << inset << bounds.width() << " x " << bounds.height() 340 DVLOG(0) << inset << bounds.width() << " x " << bounds.height()
320 << " @ " << bounds.x() << ", " << bounds.y(); 341 << " @ " << bounds.x() << ", " << bounds.y();
321 for (int i = 0; i < view->child_count(); ++i) 342 for (int i = 0; i < view->child_count(); ++i)
322 LogBounds(depth + 1, view->child_at(i)); 343 LogBounds(depth + 1, view->child_at(i));
323 } 344 }
324 345
346 MessageCenterButtonBar* MessageCenterViewTest::GetButtonBar() const {
347 return message_center_view_->button_bar_;
348 }
349
325 /* Unit tests *****************************************************************/ 350 /* Unit tests *****************************************************************/
326 351
327 TEST_F(MessageCenterViewTest, CallTest) { 352 TEST_F(MessageCenterViewTest, CallTest) {
328 // Verify that this didn't generate more than 2 Layout() call per descendant 353 // Verify that this didn't generate more than 2 Layout() call per descendant
329 // NotificationView or more than a total of 20 GetPreferredSize() and 354 // NotificationView or more than a total of 20 GetPreferredSize() and
330 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very 355 // GetHeightForWidth() calls per descendant NotificationView. 20 is a very
331 // large number corresponding to the current reality. That number will be 356 // large number corresponding to the current reality. That number will be
332 // ratcheted down over time as the code improves. 357 // ratcheted down over time as the code improves.
333 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2); 358 EXPECT_LE(GetCallCount(LAYOUT), GetNotificationCount() * 2);
334 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) + 359 EXPECT_LE(GetCallCount(GET_PREFERRED_SIZE) +
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // Mouse cursor moves out of the message center. This resets the reposition 506 // Mouse cursor moves out of the message center. This resets the reposition
482 // target in the message list. 507 // target in the message list.
483 FireOnMouseExitedEvent(); 508 FireOnMouseExitedEvent();
484 509
485 // The height should shrink from the height of the removed notification 2. 510 // The height should shrink from the height of the removed notification 2.
486 EXPECT_EQ(previous_height - previous_notification2_height - 511 EXPECT_EQ(previous_height - previous_notification2_height -
487 (kMarginBetweenItems - MessageView::GetShadowInsets().bottom()), 512 (kMarginBetweenItems - MessageView::GetShadowInsets().bottom()),
488 GetMessageListView()->height()); 513 GetMessageListView()->height());
489 } 514 }
490 515
516 TEST_F(MessageCenterViewTest, CloseButton) {
517 views::Button* close_button = GetButtonBar()->GetCloseAllButtonForTest();
518 EXPECT_NE(nullptr, close_button);
519
520 GetButtonBar()->ButtonPressed(close_button, DummyEvent());
521 base::MessageLoop::current()->Run();
522 EXPECT_TRUE(GetMessageCenter()->remove_all_closable_notification_called_);
523 }
524
525 TEST_F(MessageCenterViewTest, CloseButtonEnablity) {
526 views::Button* close_button = GetButtonBar()->GetCloseAllButtonForTest();
527 EXPECT_NE(nullptr, close_button);
528
529 // There should be 2 closable notifications.
530 EXPECT_EQ(2u, GetMessageCenter()->GetVisibleNotifications().size());
531 EXPECT_TRUE(close_button->enabled());
532
533 RemoveNotification(kNotificationId1, false);
534 base::MessageLoop::current()->Run();
535
536 // There should be 1 closable notification.
537 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
538 EXPECT_TRUE(close_button->enabled());
539
540 RemoveNotification(kNotificationId2, false);
541 base::MessageLoop::current()->Run();
542
543 // There should be no notification.
544 EXPECT_EQ(0u, GetMessageCenter()->GetVisibleNotifications().size());
545 EXPECT_FALSE(close_button->enabled());
546
547 Notification closable_notification(
548 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId1),
549 base::UTF8ToUTF16("title2"),
550 base::UTF8ToUTF16("message\nwhich\nis\nvertically\nlong\n."),
551 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(),
552 NotifierId(NotifierId::APPLICATION, "extension_id"),
553 message_center::RichNotificationData(), NULL);
554
555 Notification nonclosable_notification(
556 NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2),
557 base::UTF8ToUTF16("title2"),
558 base::UTF8ToUTF16("message\nwhich\nis\nvertically\nlong\n."),
559 gfx::Image(), base::UTF8ToUTF16("display source"), GURL(),
560 NotifierId(NotifierId::APPLICATION, "extension_id"),
561 message_center::RichNotificationData(), NULL);
562 nonclosable_notification.set_closable(false);
563
564 AddNotification(scoped_ptr<Notification>(
565 new Notification(closable_notification)));
566
567 // There should be 1 closable notification.
568 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
569 EXPECT_TRUE(close_button->enabled());
570
571 AddNotification(scoped_ptr<Notification>(
572 new Notification(nonclosable_notification)));
573
574 // There should be 1 closable notification and 1 nonclosable notification.
575 EXPECT_EQ(2u, GetMessageCenter()->GetVisibleNotifications().size());
576 EXPECT_TRUE(close_button->enabled());
577
578 RemoveNotification(kNotificationId1, false);
579
580 // There should be 1 nonclosable notification.
581 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
582 EXPECT_FALSE(close_button->enabled());
583
584 RemoveNotification(kNotificationId2, false);
585
586 // There should be no notification.
587 EXPECT_EQ(0u, GetMessageCenter()->GetVisibleNotifications().size());
588 EXPECT_FALSE(close_button->enabled());
589
590 AddNotification(scoped_ptr<Notification>(
591 new Notification(nonclosable_notification)));
592
593 // There should be 1 nonclosable notification.
594 EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
595 EXPECT_FALSE(close_button->enabled());
596 }
597
491 } // namespace message_center 598 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698