| OLD | NEW |
| 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/notification.h" | 8 #include "chrome/browser/notifications/notification.h" |
| 9 #include "chrome/browser/notifications/notification_delegate.h" | 9 #include "chrome/browser/notifications/notification_delegate.h" |
| 10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 second_extension_id_ = extension->id(); | 123 second_extension_id_ = extension->id(); |
| 124 CheckExtensionConsistency(second_extension_id_); | 124 CheckExtensionConsistency(second_extension_id_); |
| 125 } | 125 } |
| 126 | 126 |
| 127 std::string first_extension_id_; | 127 std::string first_extension_id_; |
| 128 std::string second_extension_id_; | 128 std::string second_extension_id_; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 class MAYBE_ExtensionCrashRecoveryTest : public ExtensionCrashRecoveryTestBase { | 131 class MAYBE_ExtensionCrashRecoveryTest : public ExtensionCrashRecoveryTestBase { |
| 132 protected: | 132 protected: |
| 133 virtual void AcceptNotification(size_t index) OVERRIDE { | 133 virtual void AcceptNotification(size_t index) override { |
| 134 message_center::MessageCenter* message_center = | 134 message_center::MessageCenter* message_center = |
| 135 message_center::MessageCenter::Get(); | 135 message_center::MessageCenter::Get(); |
| 136 ASSERT_GT(message_center->NotificationCount(), index); | 136 ASSERT_GT(message_center->NotificationCount(), index); |
| 137 message_center::NotificationList::Notifications::reverse_iterator it = | 137 message_center::NotificationList::Notifications::reverse_iterator it = |
| 138 message_center->GetVisibleNotifications().rbegin(); | 138 message_center->GetVisibleNotifications().rbegin(); |
| 139 for (size_t i = 0; i < index; ++i) | 139 for (size_t i = 0; i < index; ++i) |
| 140 ++it; | 140 ++it; |
| 141 std::string id = (*it)->id(); | 141 std::string id = (*it)->id(); |
| 142 message_center->ClickOnNotification(id); | 142 message_center->ClickOnNotification(id); |
| 143 WaitForExtensionLoad(); | 143 WaitForExtensionLoad(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 virtual void CancelNotification(size_t index) OVERRIDE { | 146 virtual void CancelNotification(size_t index) override { |
| 147 message_center::MessageCenter* message_center = | 147 message_center::MessageCenter* message_center = |
| 148 message_center::MessageCenter::Get(); | 148 message_center::MessageCenter::Get(); |
| 149 ASSERT_GT(message_center->NotificationCount(), index); | 149 ASSERT_GT(message_center->NotificationCount(), index); |
| 150 message_center::NotificationList::Notifications::reverse_iterator it = | 150 message_center::NotificationList::Notifications::reverse_iterator it = |
| 151 message_center->GetVisibleNotifications().rbegin(); | 151 message_center->GetVisibleNotifications().rbegin(); |
| 152 for (size_t i = 0; i < index; ++i) | 152 for (size_t i = 0; i < index; ++i) |
| 153 ++it; | 153 ++it; |
| 154 ASSERT_TRUE(g_browser_process->notification_ui_manager()-> | 154 ASSERT_TRUE(g_browser_process->notification_ui_manager()-> |
| 155 CancelById((*it)->id())); | 155 CancelById((*it)->id())); |
| 156 } | 156 } |
| 157 | 157 |
| 158 virtual size_t CountBalloons() OVERRIDE { | 158 virtual size_t CountBalloons() override { |
| 159 return message_center::MessageCenter::Get()->NotificationCount(); | 159 return message_center::MessageCenter::Get()->NotificationCount(); |
| 160 } | 160 } |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // Flaky: http://crbug.com/242167. | 163 // Flaky: http://crbug.com/242167. |
| 164 IN_PROC_BROWSER_TEST_F(MAYBE_ExtensionCrashRecoveryTest, DISABLED_Basic) { | 164 IN_PROC_BROWSER_TEST_F(MAYBE_ExtensionCrashRecoveryTest, DISABLED_Basic) { |
| 165 const size_t count_before = GetEnabledExtensionCount(); | 165 const size_t count_before = GetEnabledExtensionCount(); |
| 166 const size_t crash_count_before = GetTerminatedExtensionCount(); | 166 const size_t crash_count_before = GetTerminatedExtensionCount(); |
| 167 LoadTestExtension(); | 167 LoadTestExtension(); |
| 168 CrashExtension(first_extension_id_); | 168 CrashExtension(first_extension_id_); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 GetController())); | 552 GetController())); |
| 553 chrome::Reload(browser(), CURRENT_TAB); | 553 chrome::Reload(browser(), CURRENT_TAB); |
| 554 observer.Wait(); | 554 observer.Wait(); |
| 555 } | 555 } |
| 556 // Extension should now be loaded. | 556 // Extension should now be loaded. |
| 557 SCOPED_TRACE("after reloading the tab"); | 557 SCOPED_TRACE("after reloading the tab"); |
| 558 CheckExtensionConsistency(first_extension_id_); | 558 CheckExtensionConsistency(first_extension_id_); |
| 559 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 559 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
| 560 ASSERT_EQ(0U, CountBalloons()); | 560 ASSERT_EQ(0U, CountBalloons()); |
| 561 } | 561 } |
| OLD | NEW |