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

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

Issue 12813004: Chromium style checker cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 "base/process_util.h" 5 #include "base/process_util.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_process_manager.h" 9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::string second_extension_id_; 114 std::string second_extension_id_;
115 115
116 }; 116 };
117 117
118 // TODO(rsesek): Implement and enable these tests. http://crbug.com/179904 118 // TODO(rsesek): Implement and enable these tests. http://crbug.com/179904
119 #if defined(ENABLE_MESSAGE_CENTER) && !defined(OS_MACOSX) 119 #if defined(ENABLE_MESSAGE_CENTER) && !defined(OS_MACOSX)
120 120
121 class MessageCenterExtensionCrashRecoveryTest 121 class MessageCenterExtensionCrashRecoveryTest
122 : public ExtensionCrashRecoveryTestBase { 122 : public ExtensionCrashRecoveryTestBase {
123 protected: 123 protected:
124 virtual void AcceptNotification(size_t index) { 124 virtual void AcceptNotification(size_t index) OVERRIDE {
125 message_center::MessageCenter* message_center = 125 message_center::MessageCenter* message_center =
126 message_center::MessageCenter::Get(); 126 message_center::MessageCenter::Get();
127 ASSERT_GT(message_center->NotificationCount(), index); 127 ASSERT_GT(message_center->NotificationCount(), index);
128 message_center::NotificationList::Notifications::reverse_iterator it = 128 message_center::NotificationList::Notifications::reverse_iterator it =
129 message_center->notification_list()->GetNotifications().rbegin(); 129 message_center->notification_list()->GetNotifications().rbegin();
130 for (size_t i=0; i < index; ++i) 130 for (size_t i=0; i < index; ++i)
131 it++; 131 it++;
132 std::string id = (*it)->id(); 132 std::string id = (*it)->id();
133 message_center->OnClicked(id); 133 message_center->OnClicked(id);
134 WaitForExtensionLoad(); 134 WaitForExtensionLoad();
135 } 135 }
136 136
137 virtual void CancelNotification(size_t index) { 137 virtual void CancelNotification(size_t index) OVERRIDE {
138 message_center::MessageCenter* message_center = 138 message_center::MessageCenter* message_center =
139 message_center::MessageCenter::Get(); 139 message_center::MessageCenter::Get();
140 ASSERT_GT(message_center->NotificationCount(), index); 140 ASSERT_GT(message_center->NotificationCount(), index);
141 message_center::NotificationList::Notifications::reverse_iterator it = 141 message_center::NotificationList::Notifications::reverse_iterator it =
142 message_center->notification_list()->GetNotifications().rbegin(); 142 message_center->notification_list()->GetNotifications().rbegin();
143 for (size_t i=0; i < index; i++) { it++; } 143 for (size_t i=0; i < index; i++) { it++; }
144 ASSERT_TRUE( 144 ASSERT_TRUE(
145 g_browser_process->notification_ui_manager()->CancelById((*it)->id())); 145 g_browser_process->notification_ui_manager()->CancelById((*it)->id()));
146 } 146 }
147 147
148 virtual size_t CountBalloons() { 148 virtual size_t CountBalloons() OVERRIDE {
149 message_center::MessageCenter* message_center = 149 message_center::MessageCenter* message_center =
150 message_center::MessageCenter::Get(); 150 message_center::MessageCenter::Get();
151 return message_center->NotificationCount(); 151 return message_center->NotificationCount();
152 } 152 }
153 }; 153 };
154 154
155 typedef MessageCenterExtensionCrashRecoveryTest 155 typedef MessageCenterExtensionCrashRecoveryTest
156 MAYBE_ExtensionCrashRecoveryTest; 156 MAYBE_ExtensionCrashRecoveryTest;
157 157
158 #else // defined(ENABLED_MESSAGE_CENTER) 158 #else // defined(ENABLED_MESSAGE_CENTER)
159 159
160 class BalloonExtensionCrashRecoveryTest 160 class BalloonExtensionCrashRecoveryTest
161 : public ExtensionCrashRecoveryTestBase { 161 : public ExtensionCrashRecoveryTestBase {
162 protected: 162 protected:
163 virtual void AcceptNotification(size_t index) { 163 virtual void AcceptNotification(size_t index) OVERRIDE {
164 Balloon* balloon = GetNotificationDelegate(index); 164 Balloon* balloon = GetNotificationDelegate(index);
165 ASSERT_TRUE(balloon); 165 ASSERT_TRUE(balloon);
166 balloon->OnClick(); 166 balloon->OnClick();
167 WaitForExtensionLoad(); 167 WaitForExtensionLoad();
168 } 168 }
169 169
170 virtual void CancelNotification(size_t index) { 170 virtual void CancelNotification(size_t index) OVERRIDE {
171 Balloon* balloon = GetNotificationDelegate(index); 171 Balloon* balloon = GetNotificationDelegate(index);
172 ASSERT_TRUE(balloon); 172 ASSERT_TRUE(balloon);
173 std::string id = balloon->notification().notification_id(); 173 std::string id = balloon->notification().notification_id();
174 ASSERT_TRUE(g_browser_process->notification_ui_manager()->CancelById(id)); 174 ASSERT_TRUE(g_browser_process->notification_ui_manager()->CancelById(id));
175 } 175 }
176 176
177 virtual size_t CountBalloons() { 177 virtual size_t CountBalloons() OVERRIDE {
178 BalloonNotificationUIManager* manager = 178 BalloonNotificationUIManager* manager =
179 BalloonNotificationUIManager::GetInstanceForTesting(); 179 BalloonNotificationUIManager::GetInstanceForTesting();
180 BalloonCollection::Balloons balloons = 180 BalloonCollection::Balloons balloons =
181 manager->balloon_collection()->GetActiveBalloons(); 181 manager->balloon_collection()->GetActiveBalloons();
182 return balloons.size(); 182 return balloons.size();
183 } 183 }
184 private: 184 private:
185 Balloon* GetNotificationDelegate(size_t index) { 185 Balloon* GetNotificationDelegate(size_t index) {
186 BalloonNotificationUIManager* manager = 186 BalloonNotificationUIManager* manager =
187 BalloonNotificationUIManager::GetInstanceForTesting(); 187 BalloonNotificationUIManager::GetInstanceForTesting();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 GetController())); 573 GetController()));
574 chrome::Reload(browser(), CURRENT_TAB); 574 chrome::Reload(browser(), CURRENT_TAB);
575 observer.Wait(); 575 observer.Wait();
576 } 576 }
577 // Extension should now be loaded. 577 // Extension should now be loaded.
578 SCOPED_TRACE("after reloading the tab"); 578 SCOPED_TRACE("after reloading the tab");
579 CheckExtensionConsistency(first_extension_id_); 579 CheckExtensionConsistency(first_extension_id_);
580 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); 580 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
581 ASSERT_EQ(0U, CountBalloons()); 581 ASSERT_EQ(0U, CountBalloons());
582 } 582 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698