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

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

Powered by Google App Engine
This is Rietveld 408576698