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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 EXPECT_FALSE(HasNotification(message_center, "test_id1")); 141 EXPECT_FALSE(HasNotification(message_center, "test_id1"));
142 EXPECT_EQ(1u, message_center->NotificationCount()); 142 EXPECT_EQ(1u, message_center->NotificationCount());
143 143
144 // Remove the remaining notification. 144 // Remove the remaining notification.
145 RemoveNotification("test_id3"); 145 RemoveNotification("test_id3");
146 EXPECT_EQ(0u, message_center->NotificationCount()); 146 EXPECT_EQ(0u, message_center->NotificationCount());
147 EXPECT_FALSE(HasNotification(message_center, "test_id1")); 147 EXPECT_FALSE(HasNotification(message_center, "test_id1"));
148 } 148 }
149 149
150 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) { 150 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
151 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray()); 151 std::unique_ptr<WebNotificationTray> tray(new WebNotificationTray());
152 tray->message_center(); 152 tray->message_center();
153 153
154 // Adding a notification should show the popup bubble. 154 // Adding a notification should show the popup bubble.
155 AddNotification("test_id1", "replace_id1"); 155 AddNotification("test_id1", "replace_id1");
156 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 156 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
157 157
158 // Updating a notification should not hide the popup bubble. 158 // Updating a notification should not hide the popup bubble.
159 AddNotification("test_id2", "replace_id2"); 159 AddNotification("test_id2", "replace_id2");
160 UpdateNotification("replace_id2", "test_id3"); 160 UpdateNotification("replace_id2", "test_id3");
161 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 161 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
162 162
163 // Removing the first notification should not hide the popup bubble. 163 // Removing the first notification should not hide the popup bubble.
164 RemoveNotification("test_id1"); 164 RemoveNotification("test_id1");
165 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 165 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
166 166
167 // Removing the visible notification should hide the popup bubble. 167 // Removing the visible notification should hide the popup bubble.
168 RemoveNotification("test_id3"); 168 RemoveNotification("test_id3");
169 EXPECT_FALSE(tray->message_center_tray_->popups_visible()); 169 EXPECT_FALSE(tray->message_center_tray_->popups_visible());
170 } 170 }
171 171
172 using message_center::NotificationList; 172 using message_center::NotificationList;
173 173
174 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) { 174 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) {
175 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray()); 175 std::unique_ptr<WebNotificationTray> tray(new WebNotificationTray());
176 message_center::MessageCenter* message_center = tray->message_center(); 176 message_center::MessageCenter* message_center = tray->message_center();
177 177
178 // Add the max visible popup notifications +1, ensure the correct num visible. 178 // Add the max visible popup notifications +1, ensure the correct num visible.
179 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1; 179 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1;
180 for (size_t i = 0; i < notifications_to_add; ++i) { 180 for (size_t i = 0; i < notifications_to_add; ++i) {
181 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); 181 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i));
182 std::string replace_id = 182 std::string replace_id =
183 base::StringPrintf("replace_id%d", static_cast<int>(i)); 183 base::StringPrintf("replace_id%d", static_cast<int>(i));
184 AddNotification(id, replace_id); 184 AddNotification(id, replace_id);
185 } 185 }
186 // Hide and reshow the bubble so that it is updated immediately, not delayed. 186 // Hide and reshow the bubble so that it is updated immediately, not delayed.
187 tray->message_center_tray_->HidePopupBubble(); 187 tray->message_center_tray_->HidePopupBubble();
188 tray->message_center_tray_->ShowPopupBubble(); 188 tray->message_center_tray_->ShowPopupBubble();
189 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); 189 EXPECT_TRUE(tray->message_center_tray_->popups_visible());
190 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); 190 EXPECT_EQ(notifications_to_add, message_center->NotificationCount());
191 NotificationList::PopupNotifications popups = 191 NotificationList::PopupNotifications popups =
192 message_center->GetPopupNotifications(); 192 message_center->GetPopupNotifications();
193 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); 193 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size());
194 } 194 }
195 195
196 } // namespace message_center 196 } // namespace message_center
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/message_center/web_notification_tray.h ('k') | chrome/browser/ui/views/new_task_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698