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

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

Issue 14327004: Moved some message center constants to message_center_constants.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_win.h" 5 #include "chrome/browser/ui/views/message_center/web_notification_tray_win.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"
11 #include "ash/system/tray/system_tray_item.h" 11 #include "ash/system/tray/system_tray_item.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
16 #include "ui/message_center/message_center_constants.h"
16 #include "ui/message_center/message_center_tray.h" 17 #include "ui/message_center/message_center_tray.h"
17 #include "ui/message_center/notification_list.h" 18 #include "ui/message_center/notification_list.h"
18 #include "ui/message_center/notification_types.h" 19 #include "ui/message_center/notification_types.h"
19 #include "ui/message_center/views/message_center_bubble.h" 20 #include "ui/message_center/views/message_center_bubble.h"
20 #include "ui/message_center/views/message_popup_collection.h" 21 #include "ui/message_center/views/message_popup_collection.h"
21 #include "ui/views/controls/label.h" 22 #include "ui/views/controls/label.h"
22 #include "ui/views/layout/fill_layout.h" 23 #include "ui/views/layout/fill_layout.h"
23 #include "ui/views/view.h" 24 #include "ui/views/view.h"
24 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
25 26
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 using message_center::NotificationList; 125 using message_center::NotificationList;
125 126
126 // Flaky, see http://crbug.com/222500 . 127 // Flaky, see http://crbug.com/222500 .
127 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, 128 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest,
128 DISABLED_ManyMessageCenterNotifications) { 129 DISABLED_ManyMessageCenterNotifications) {
129 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin()); 130 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin());
130 message_center::MessageCenter* message_center = tray->message_center(); 131 message_center::MessageCenter* message_center = tray->message_center();
131 132
132 // Add the max visible notifications +1, ensure the correct visible number. 133 // Add the max visible notifications +1, ensure the correct visible number.
133 size_t notifications_to_add = 134 size_t notifications_to_add = kMaxVisibleMessageCenterNotifications + 1;
134 NotificationList::kMaxVisibleMessageCenterNotifications + 1;
135 for (size_t i = 0; i < notifications_to_add; ++i) { 135 for (size_t i = 0; i < notifications_to_add; ++i) {
136 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); 136 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
137 AddNotification(id); 137 AddNotification(id);
138 } 138 }
139 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); 139 bool shown = tray->message_center_tray_->ShowMessageCenterBubble();
140 EXPECT_TRUE(shown); 140 EXPECT_TRUE(shown);
141 content::RunAllPendingInMessageLoop(); 141 content::RunAllPendingInMessageLoop();
142 EXPECT_TRUE(tray->message_center_bubble_.get() != NULL); 142 EXPECT_TRUE(tray->message_center_bubble_.get() != NULL);
143 EXPECT_EQ(notifications_to_add, 143 EXPECT_EQ(notifications_to_add,
144 message_center->NotificationCount()); 144 message_center->NotificationCount());
145 EXPECT_EQ(NotificationList::kMaxVisibleMessageCenterNotifications, 145 EXPECT_EQ(kMaxVisibleMessageCenterNotifications,
146 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest()); 146 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest());
147 } 147 }
148 148
149 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, ManyPopupNotifications) { 149 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, ManyPopupNotifications) {
150 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin()); 150 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin());
151 message_center::MessageCenter* message_center = tray->message_center(); 151 message_center::MessageCenter* message_center = tray->message_center();
152 152
153 // Add the max visible popup notifications +1, ensure the correct num visible. 153 // Add the max visible popup notifications +1, ensure the correct num visible.
154 size_t notifications_to_add = 154 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1;
155 NotificationList::kMaxVisiblePopupNotifications + 1;
156 for (size_t i = 0; i < notifications_to_add; ++i) { 155 for (size_t i = 0; i < notifications_to_add; ++i) {
157 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); 156 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
158 AddNotification(id); 157 AddNotification(id);
159 } 158 }
160 // Hide and reshow the bubble so that it is updated immediately, not delayed. 159 // Hide and reshow the bubble so that it is updated immediately, not delayed.
161 tray->message_center_tray_->HidePopupBubble(); 160 tray->message_center_tray_->HidePopupBubble();
162 tray->message_center_tray_->ShowPopupBubble(); 161 tray->message_center_tray_->ShowPopupBubble();
163 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 162 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
164 EXPECT_EQ(notifications_to_add, 163 EXPECT_EQ(notifications_to_add,
165 message_center->NotificationCount()); 164 message_center->NotificationCount());
166 NotificationList::PopupNotifications popups = 165 NotificationList::PopupNotifications popups =
167 message_center->GetPopupNotifications(); 166 message_center->GetPopupNotifications();
168 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size()); 167 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size());
169 } 168 }
170 169
171 } // namespace message_center 170 } // namespace message_center
OLDNEW
« no previous file with comments | « ash/system/web_notification/web_notification_tray_unittest.cc ('k') | ui/message_center/message_center_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698