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

Side by Side Diff: ash/system/web_notification/web_notification_tray_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 190
191 TEST_F(WebNotificationTrayTest, ManyMessageCenterNotifications) { 191 TEST_F(WebNotificationTrayTest, ManyMessageCenterNotifications) {
192 WebNotificationTray* tray = GetWebNotificationTray(); 192 WebNotificationTray* tray = GetWebNotificationTray();
193 scoped_ptr<TestDelegate> delegate(new TestDelegate(get_message_center())); 193 scoped_ptr<TestDelegate> delegate(new TestDelegate(get_message_center()));
194 194
195 // Add the max visible notifications +1, ensure the correct visible number. 195 // Add the max visible notifications +1, ensure the correct visible number.
196 size_t notifications_to_add = 196 size_t notifications_to_add =
197 NotificationList::kMaxVisibleMessageCenterNotifications + 1; 197 NotificationList::kMaxVisibleMessageCenterNotifications + 1;
198 for (size_t i = 0; i < notifications_to_add; ++i) { 198 for (size_t i = 0; i < notifications_to_add; ++i) {
199 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); 199 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
200 delegate->AddNotification(tray, id); 200 delegate->AddNotification(tray, id);
201 } 201 }
202 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); 202 bool shown = tray->message_center_tray_->ShowMessageCenterBubble();
203 EXPECT_TRUE(shown); 203 EXPECT_TRUE(shown);
204 RunAllPendingInMessageLoop(); 204 RunAllPendingInMessageLoop();
205 EXPECT_TRUE(tray->message_center_bubble() != NULL); 205 EXPECT_TRUE(tray->message_center_bubble() != NULL);
206 EXPECT_EQ(notifications_to_add, 206 EXPECT_EQ(notifications_to_add,
207 get_message_center()->NotificationCount()); 207 get_message_center()->NotificationCount());
208 EXPECT_EQ(NotificationList::kMaxVisibleMessageCenterNotifications, 208 EXPECT_EQ(NotificationList::kMaxVisibleMessageCenterNotifications,
209 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest()); 209 tray->GetMessageCenterBubbleForTest()->NumMessageViewsForTest());
210 } 210 }
211 211
212 TEST_F(WebNotificationTrayTest, ManyPopupNotifications) { 212 TEST_F(WebNotificationTrayTest, ManyPopupNotifications) {
213 WebNotificationTray* tray = GetWebNotificationTray(); 213 WebNotificationTray* tray = GetWebNotificationTray();
214 scoped_ptr<TestDelegate> delegate(new TestDelegate(get_message_center())); 214 scoped_ptr<TestDelegate> delegate(new TestDelegate(get_message_center()));
215 215
216 // Add the max visible popup notifications +1, ensure the correct num visible. 216 // Add the max visible popup notifications +1, ensure the correct num visible.
217 size_t notifications_to_add = 217 size_t notifications_to_add =
218 NotificationList::kMaxVisiblePopupNotifications + 1; 218 NotificationList::kMaxVisiblePopupNotifications + 1;
219 for (size_t i = 0; i < notifications_to_add; ++i) { 219 for (size_t i = 0; i < notifications_to_add; ++i) {
220 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); 220 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
221 delegate->AddNotification(tray, id); 221 delegate->AddNotification(tray, id);
222 } 222 }
223 // Hide and reshow the bubble so that it is updated immediately, not delayed. 223 // Hide and reshow the bubble so that it is updated immediately, not delayed.
224 tray->SetHidePopupBubble(true); 224 tray->SetHidePopupBubble(true);
225 tray->SetHidePopupBubble(false); 225 tray->SetHidePopupBubble(false);
226 EXPECT_TRUE(tray->IsPopupVisible()); 226 EXPECT_TRUE(tray->IsPopupVisible());
227 EXPECT_EQ(notifications_to_add, 227 EXPECT_EQ(notifications_to_add,
228 get_message_center()->NotificationCount()); 228 get_message_center()->NotificationCount());
229 if (message_center::IsRichNotificationEnabled()) { 229 if (message_center::IsRichNotificationEnabled()) {
230 NotificationList::PopupNotifications popups = 230 NotificationList::PopupNotifications popups =
231 get_message_center()->notification_list()->GetPopupNotifications(); 231 get_message_center()->notification_list()->GetPopupNotifications();
232 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size()); 232 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size());
233 } else { 233 } else {
234 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, 234 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications,
235 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); 235 tray->GetPopupBubbleForTest()->NumMessageViewsForTest());
236 } 236 }
237 get_message_center()->SetDelegate(NULL); 237 get_message_center()->SetDelegate(NULL);
238 get_message_center()->notification_list()->RemoveAllNotifications(); 238 get_message_center()->notification_list()->RemoveAllNotifications();
239 } 239 }
240 240
241 } // namespace ash 241 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698