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

Side by Side Diff: chrome/browser/extensions/extension_crash_recovery_browsertest.cc

Issue 231213003: notification balloons: Remove views and cocoa implementations of BalloonCollection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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) 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 "chrome/browser/browser_process.h" 5 #include "chrome/browser/browser_process.h"
6 #include "chrome/browser/extensions/extension_browsertest.h" 6 #include "chrome/browser/extensions/extension_browsertest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/notifications/balloon.h" 8 #include "chrome/browser/notifications/balloon.h"
9 #include "chrome/browser/notifications/balloon_collection.h" 9 #include "chrome/browser/notifications/balloon_collection.h"
10 #include "chrome/browser/notifications/balloon_host.h" 10 #include "chrome/browser/notifications/balloon_host.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (message_center::IsRichNotificationEnabled()) { 140 if (message_center::IsRichNotificationEnabled()) {
141 message_center::MessageCenter* message_center = 141 message_center::MessageCenter* message_center =
142 message_center::MessageCenter::Get(); 142 message_center::MessageCenter::Get();
143 ASSERT_GT(message_center->NotificationCount(), index); 143 ASSERT_GT(message_center->NotificationCount(), index);
144 message_center::NotificationList::Notifications::reverse_iterator it = 144 message_center::NotificationList::Notifications::reverse_iterator it =
145 message_center->GetVisibleNotifications().rbegin(); 145 message_center->GetVisibleNotifications().rbegin();
146 for (size_t i=0; i < index; ++i) 146 for (size_t i=0; i < index; ++i)
147 it++; 147 it++;
148 std::string id = (*it)->id(); 148 std::string id = (*it)->id();
149 message_center->ClickOnNotification(id); 149 message_center->ClickOnNotification(id);
150 #if !defined(OS_CHROMEOS) 150 #if defined(TOOLKIT_GTK)
151 } else { 151 } else {
152 Balloon* balloon = GetNotificationDelegate(index); 152 Balloon* balloon = GetNotificationDelegate(index);
153 ASSERT_TRUE(balloon); 153 ASSERT_TRUE(balloon);
154 balloon->OnClick(); 154 balloon->OnClick();
155 #endif 155 #endif
156 } 156 }
157 WaitForExtensionLoad(); 157 WaitForExtensionLoad();
158 } 158 }
159 159
160 virtual void CancelNotification(size_t index) OVERRIDE { 160 virtual void CancelNotification(size_t index) OVERRIDE {
161 if (message_center::IsRichNotificationEnabled()) { 161 if (message_center::IsRichNotificationEnabled()) {
162 message_center::MessageCenter* message_center = 162 message_center::MessageCenter* message_center =
163 message_center::MessageCenter::Get(); 163 message_center::MessageCenter::Get();
164 ASSERT_GT(message_center->NotificationCount(), index); 164 ASSERT_GT(message_center->NotificationCount(), index);
165 message_center::NotificationList::Notifications::reverse_iterator it = 165 message_center::NotificationList::Notifications::reverse_iterator it =
166 message_center->GetVisibleNotifications().rbegin(); 166 message_center->GetVisibleNotifications().rbegin();
167 for (size_t i=0; i < index; i++) { it++; } 167 for (size_t i=0; i < index; i++) { it++; }
168 ASSERT_TRUE(g_browser_process->notification_ui_manager()-> 168 ASSERT_TRUE(g_browser_process->notification_ui_manager()->
169 CancelById((*it)->id())); 169 CancelById((*it)->id()));
170 #if !defined(OS_CHROMEOS) 170 #if defined(TOOLKIT_GTK)
171 } else { 171 } else {
172 Balloon* balloon = GetNotificationDelegate(index); 172 Balloon* balloon = GetNotificationDelegate(index);
173 ASSERT_TRUE(balloon); 173 ASSERT_TRUE(balloon);
174 std::string id = balloon->notification().notification_id(); 174 std::string id = balloon->notification().notification_id();
175 ASSERT_TRUE(g_browser_process->notification_ui_manager()->CancelById(id)); 175 ASSERT_TRUE(g_browser_process->notification_ui_manager()->CancelById(id));
176 #endif 176 #endif
177 } 177 }
178 } 178 }
179 179
180 virtual size_t CountBalloons() OVERRIDE { 180 virtual size_t CountBalloons() OVERRIDE {
181 if (message_center::IsRichNotificationEnabled()) 181 if (message_center::IsRichNotificationEnabled())
182 return message_center::MessageCenter::Get()->NotificationCount(); 182 return message_center::MessageCenter::Get()->NotificationCount();
183 183
184 #if defined(OS_CHROMEOS) 184 #if defined(TOOLKIT_GTK)
185 return BalloonNotificationUIManager::GetInstanceForTesting()->
186 balloon_collection()->GetActiveBalloons().size();
187 #else
185 CHECK(false); 188 CHECK(false);
186 return 0; 189 return 0;
187 #else
188 return BalloonNotificationUIManager::GetInstanceForTesting()->
189 balloon_collection()->GetActiveBalloons().size();
190 #endif 190 #endif
191 } 191 }
192 192
193 private: 193 private:
194 #if !defined(OS_CHROMEOS) 194 #if defined(TOOLKIT_GTK)
195 Balloon* GetNotificationDelegate(size_t index) { 195 Balloon* GetNotificationDelegate(size_t index) {
196 BalloonNotificationUIManager* manager = 196 BalloonNotificationUIManager* manager =
197 BalloonNotificationUIManager::GetInstanceForTesting(); 197 BalloonNotificationUIManager::GetInstanceForTesting();
198 BalloonCollection::Balloons balloons = 198 BalloonCollection::Balloons balloons =
199 manager->balloon_collection()->GetActiveBalloons(); 199 manager->balloon_collection()->GetActiveBalloons();
200 return index < balloons.size() ? balloons.at(index) : NULL; 200 return index < balloons.size() ? balloons.at(index) : NULL;
201 } 201 }
202 #endif 202 #endif
203 }; 203 };
204 204
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 GetController())); 593 GetController()));
594 chrome::Reload(browser(), CURRENT_TAB); 594 chrome::Reload(browser(), CURRENT_TAB);
595 observer.Wait(); 595 observer.Wait();
596 } 596 }
597 // Extension should now be loaded. 597 // Extension should now be loaded.
598 SCOPED_TRACE("after reloading the tab"); 598 SCOPED_TRACE("after reloading the tab");
599 CheckExtensionConsistency(first_extension_id_); 599 CheckExtensionConsistency(first_extension_id_);
600 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); 600 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount());
601 ASSERT_EQ(0U, CountBalloons()); 601 ASSERT_EQ(0U, CountBalloons());
602 } 602 }
OLDNEW
« no previous file with comments | « chrome/app/nibs/Notification.xib ('k') | chrome/browser/notifications/balloon_collection_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698