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

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

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 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 | 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"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, 169 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest,
170 ManyMessageCenterNotifications) { 170 ManyMessageCenterNotifications) {
171 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin()); 171 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin());
172 message_center::MessageCenter* message_center = tray->message_center(); 172 message_center::MessageCenter* message_center = tray->message_center();
173 scoped_ptr<TestDelegate> delegate(new TestDelegate(message_center)); 173 scoped_ptr<TestDelegate> delegate(new TestDelegate(message_center));
174 174
175 // Add the max visible notifications +1, ensure the correct visible number. 175 // Add the max visible notifications +1, ensure the correct visible number.
176 size_t notifications_to_add = 176 size_t notifications_to_add =
177 NotificationList::kMaxVisibleMessageCenterNotifications + 1; 177 NotificationList::kMaxVisibleMessageCenterNotifications + 1;
178 for (size_t i = 0; i < notifications_to_add; ++i) { 178 for (size_t i = 0; i < notifications_to_add; ++i) {
179 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); 179 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
180 delegate->AddNotification(id); 180 delegate->AddNotification(id);
181 } 181 }
182 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); 182 bool shown = tray->message_center_tray_->ShowMessageCenterBubble();
183 EXPECT_TRUE(shown); 183 EXPECT_TRUE(shown);
184 content::RunAllPendingInMessageLoop(); 184 content::RunAllPendingInMessageLoop();
185 EXPECT_TRUE(tray->message_center_bubble_.get() != NULL); 185 EXPECT_TRUE(tray->message_center_bubble_.get() != NULL);
186 EXPECT_EQ(notifications_to_add, 186 EXPECT_EQ(notifications_to_add,
187 message_center->NotificationCount()); 187 message_center->NotificationCount());
188 EXPECT_EQ(NotificationList::kMaxVisibleMessageCenterNotifications, 188 EXPECT_EQ(NotificationList::kMaxVisibleMessageCenterNotifications,
189 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest()); 189 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest());
190 } 190 }
191 191
192 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, ManyPopupNotifications) { 192 IN_PROC_BROWSER_TEST_F(WebNotificationTrayWinTest, ManyPopupNotifications) {
193 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin()); 193 scoped_ptr<WebNotificationTrayWin> tray(new WebNotificationTrayWin());
194 message_center::MessageCenter* message_center = tray->message_center(); 194 message_center::MessageCenter* message_center = tray->message_center();
195 scoped_ptr<TestDelegate> delegate(new TestDelegate(message_center)); 195 scoped_ptr<TestDelegate> delegate(new TestDelegate(message_center));
196 196
197 // Add the max visible popup notifications +1, ensure the correct num visible. 197 // Add the max visible popup notifications +1, ensure the correct num visible.
198 size_t notifications_to_add = 198 size_t notifications_to_add =
199 NotificationList::kMaxVisiblePopupNotifications + 1; 199 NotificationList::kMaxVisiblePopupNotifications + 1;
200 for (size_t i = 0; i < notifications_to_add; ++i) { 200 for (size_t i = 0; i < notifications_to_add; ++i) {
201 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); 201 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
202 delegate->AddNotification(id); 202 delegate->AddNotification(id);
203 } 203 }
204 // Hide and reshow the bubble so that it is updated immediately, not delayed. 204 // Hide and reshow the bubble so that it is updated immediately, not delayed.
205 tray->message_center_tray_->HidePopupBubble(); 205 tray->message_center_tray_->HidePopupBubble();
206 tray->message_center_tray_->ShowPopupBubble(); 206 tray->message_center_tray_->ShowPopupBubble();
207 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 207 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
208 EXPECT_EQ(notifications_to_add, 208 EXPECT_EQ(notifications_to_add,
209 message_center->NotificationCount()); 209 message_center->NotificationCount());
210 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, 210 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications,
211 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); 211 tray->GetPopupBubbleForTest()->NumMessageViewsForTest());
212 message_center->SetDelegate(NULL); 212 message_center->SetDelegate(NULL);
213 message_center->notification_list()->RemoveAllNotifications(); 213 message_center->notification_list()->RemoveAllNotifications();
214 } 214 }
215 215
216 } // namespace message_center 216 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698