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

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/message_center/web_notification_tray.h" 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/system/status_area_widget.h" 10 #include "ash/system/status_area_widget.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 size_t notifications_to_add = kMaxVisibleMessageCenterNotifications + 1; 166 size_t notifications_to_add = kMaxVisibleMessageCenterNotifications + 1;
167 for (size_t i = 0; i < notifications_to_add; ++i) { 167 for (size_t i = 0; i < notifications_to_add; ++i) {
168 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); 168 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
169 std::string replace_id = 169 std::string replace_id =
170 base::StringPrintf("replace_id%d", static_cast<int>(i)); 170 base::StringPrintf("replace_id%d", static_cast<int>(i));
171 AddNotification(id, replace_id); 171 AddNotification(id, replace_id);
172 } 172 }
173 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); 173 bool shown = tray->message_center_tray_->ShowMessageCenterBubble();
174 EXPECT_TRUE(shown); 174 EXPECT_TRUE(shown);
175 content::RunAllPendingInMessageLoop(); 175 content::RunAllPendingInMessageLoop();
176 EXPECT_TRUE(tray->message_center_bubble_.get() != NULL); 176 EXPECT_TRUE(tray->message_center_delegate_ != NULL);
177 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); 177 EXPECT_EQ(notifications_to_add, message_center->NotificationCount());
178 EXPECT_EQ(kMaxVisibleMessageCenterNotifications, 178 EXPECT_EQ(kMaxVisibleMessageCenterNotifications,
179 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest()); 179 tray->message_center_delegate_->NumMessageViewsForTest());
180 } 180 }
181 181
182 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) { 182 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) {
183 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray()); 183 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray());
184 message_center::MessageCenter* message_center = tray->message_center(); 184 message_center::MessageCenter* message_center = tray->message_center();
185 185
186 // Add the max visible popup notifications +1, ensure the correct num visible. 186 // Add the max visible popup notifications +1, ensure the correct num visible.
187 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1; 187 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1;
188 for (size_t i = 0; i < notifications_to_add; ++i) { 188 for (size_t i = 0; i < notifications_to_add; ++i) {
189 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); 189 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
190 std::string replace_id = 190 std::string replace_id =
191 base::StringPrintf("replace_id%d", static_cast<int>(i)); 191 base::StringPrintf("replace_id%d", static_cast<int>(i));
192 AddNotification(id, replace_id); 192 AddNotification(id, replace_id);
193 } 193 }
194 // Hide and reshow the bubble so that it is updated immediately, not delayed. 194 // Hide and reshow the bubble so that it is updated immediately, not delayed.
195 tray->message_center_tray_->HidePopupBubble(); 195 tray->message_center_tray_->HidePopupBubble();
196 tray->message_center_tray_->ShowPopupBubble(); 196 tray->message_center_tray_->ShowPopupBubble();
197 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 197 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
198 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); 198 EXPECT_EQ(notifications_to_add, message_center->NotificationCount());
199 NotificationList::PopupNotifications popups = 199 NotificationList::PopupNotifications popups =
200 message_center->GetPopupNotifications(); 200 message_center->GetPopupNotifications();
201 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); 201 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size());
202 } 202 }
203 203
204 } // namespace message_center 204 } // namespace message_center
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/message_center/web_notification_tray.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698