| Index: chrome/browser/extensions/extension_crash_recovery_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/extension_crash_recovery_browsertest.cc (revision 263121)
|
| +++ chrome/browser/extensions/extension_crash_recovery_browsertest.cc (working copy)
|
| @@ -5,11 +5,9 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/extensions/extension_browsertest.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| -#include "chrome/browser/notifications/balloon.h"
|
| -#include "chrome/browser/notifications/balloon_collection.h"
|
| -#include "chrome/browser/notifications/balloon_host.h"
|
| #include "chrome/browser/notifications/notification.h"
|
| #include "chrome/browser/notifications/notification_delegate.h"
|
| +#include "chrome/browser/notifications/notification_ui_manager.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| @@ -30,12 +28,6 @@
|
| #include "ui/message_center/message_center_util.h"
|
| #include "ui/message_center/notification_list.h"
|
|
|
| -#if defined(OS_CHROMEOS)
|
| -#include "chrome/browser/notifications/notification_ui_manager.h"
|
| -#else
|
| -#include "chrome/browser/notifications/balloon_notification_ui_manager.h"
|
| -#endif
|
| -
|
| using content::NavigationController;
|
| using content::WebContents;
|
| using extensions::Extension;
|
| @@ -137,69 +129,32 @@
|
| : public ExtensionCrashRecoveryTestBase {
|
| protected:
|
| virtual void AcceptNotification(size_t index) OVERRIDE {
|
| - if (message_center::IsRichNotificationEnabled()) {
|
| - message_center::MessageCenter* message_center =
|
| - message_center::MessageCenter::Get();
|
| - ASSERT_GT(message_center->NotificationCount(), index);
|
| - message_center::NotificationList::Notifications::reverse_iterator it =
|
| - message_center->GetVisibleNotifications().rbegin();
|
| - for (size_t i=0; i < index; ++i)
|
| - it++;
|
| - std::string id = (*it)->id();
|
| - message_center->ClickOnNotification(id);
|
| -#if defined(TOOLKIT_GTK)
|
| - } else {
|
| - Balloon* balloon = GetNotificationDelegate(index);
|
| - ASSERT_TRUE(balloon);
|
| - balloon->OnClick();
|
| -#endif
|
| - }
|
| + message_center::MessageCenter* message_center =
|
| + message_center::MessageCenter::Get();
|
| + ASSERT_GT(message_center->NotificationCount(), index);
|
| + message_center::NotificationList::Notifications::reverse_iterator it =
|
| + message_center->GetVisibleNotifications().rbegin();
|
| + for (size_t i=0; i < index; ++i)
|
| + it++;
|
| + std::string id = (*it)->id();
|
| + message_center->ClickOnNotification(id);
|
| WaitForExtensionLoad();
|
| }
|
|
|
| virtual void CancelNotification(size_t index) OVERRIDE {
|
| - if (message_center::IsRichNotificationEnabled()) {
|
| - message_center::MessageCenter* message_center =
|
| - message_center::MessageCenter::Get();
|
| - ASSERT_GT(message_center->NotificationCount(), index);
|
| - message_center::NotificationList::Notifications::reverse_iterator it =
|
| - message_center->GetVisibleNotifications().rbegin();
|
| - for (size_t i=0; i < index; i++) { it++; }
|
| - ASSERT_TRUE(g_browser_process->notification_ui_manager()->
|
| - CancelById((*it)->id()));
|
| -#if defined(TOOLKIT_GTK)
|
| - } else {
|
| - Balloon* balloon = GetNotificationDelegate(index);
|
| - ASSERT_TRUE(balloon);
|
| - std::string id = balloon->notification().notification_id();
|
| - ASSERT_TRUE(g_browser_process->notification_ui_manager()->CancelById(id));
|
| -#endif
|
| - }
|
| + message_center::MessageCenter* message_center =
|
| + message_center::MessageCenter::Get();
|
| + ASSERT_GT(message_center->NotificationCount(), index);
|
| + message_center::NotificationList::Notifications::reverse_iterator it =
|
| + message_center->GetVisibleNotifications().rbegin();
|
| + for (size_t i=0; i < index; i++) { it++; }
|
| + ASSERT_TRUE(g_browser_process->notification_ui_manager()->
|
| + CancelById((*it)->id()));
|
| }
|
|
|
| virtual size_t CountBalloons() OVERRIDE {
|
| - if (message_center::IsRichNotificationEnabled())
|
| - return message_center::MessageCenter::Get()->NotificationCount();
|
| -
|
| -#if defined(TOOLKIT_GTK)
|
| - return BalloonNotificationUIManager::GetInstanceForTesting()->
|
| - balloon_collection()->GetActiveBalloons().size();
|
| -#else
|
| - CHECK(false);
|
| - return 0;
|
| -#endif
|
| + return message_center::MessageCenter::Get()->NotificationCount();
|
| }
|
| -
|
| - private:
|
| -#if defined(TOOLKIT_GTK)
|
| - Balloon* GetNotificationDelegate(size_t index) {
|
| - BalloonNotificationUIManager* manager =
|
| - BalloonNotificationUIManager::GetInstanceForTesting();
|
| - BalloonCollection::Balloons balloons =
|
| - manager->balloon_collection()->GetActiveBalloons();
|
| - return index < balloons.size() ? balloons.at(index) : NULL;
|
| - }
|
| -#endif
|
| };
|
|
|
| // Flaky: http://crbug.com/242167.
|
|
|