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

Unified Diff: chrome/browser/extensions/extension_crash_recovery_browsertest.cc

Issue 11428085: Fix couple of issues in ExtensionCrashRecoveryTest. In particular the (Closed) Base URL: http://git.chromium.org/chromium/src.git@extension_crash
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_crash_recovery_browsertest.cc
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index 51ee2cedcabd38ae69d2f95d9ba2d76d3977f7da..2cfd72e9c679a2e0846094e91c7c081ec6cedda9 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -46,14 +46,6 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
process_manager();
}
- Balloon* GetNotificationDelegate(size_t index) {
- NotificationUIManager* manager =
- g_browser_process->notification_ui_manager();
- BalloonCollection::Balloons balloons =
- manager->balloon_collection()->GetActiveBalloons();
- return balloons.at(index);
- }
-
void AcceptNotification(size_t index) {
Balloon* balloon = GetNotificationDelegate(index);
ASSERT_TRUE(balloon);
@@ -63,6 +55,7 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
void CancelNotification(size_t index) {
Balloon* balloon = GetNotificationDelegate(index);
+ ASSERT_TRUE(balloon);
NotificationUIManager* manager =
g_browser_process->notification_ui_manager();
ASSERT_TRUE(manager->CancelById(balloon->notification().notification_id()));
@@ -130,6 +123,15 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
std::string first_extension_id_;
std::string second_extension_id_;
+
+ private:
+ Balloon* GetNotificationDelegate(size_t index) {
+ NotificationUIManager* manager =
+ g_browser_process->notification_ui_manager();
+ BalloonCollection::Balloons balloons =
+ manager->balloon_collection()->GetActiveBalloons();
+ return index < balloons.size() ? balloons.at(index) : NULL;
+ }
};
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, Basic) {
@@ -141,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, Basic) {
ASSERT_EQ(size_before, GetExtensionService()->extensions()->size());
ASSERT_EQ(crash_size_before + 1,
GetExtensionService()->terminated_extensions()->size());
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
SCOPED_TRACE("after clicking the balloon");
CheckExtensionConsistency(first_extension_id_);
@@ -160,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, CloseAndReload) {
ASSERT_EQ(crash_size_before + 1,
GetExtensionService()->terminated_extensions()->size());
- CancelNotification(0);
+ ASSERT_NO_FATAL_FAILURE(CancelNotification(0));
ReloadExtension(first_extension_id_);
SCOPED_TRACE("after reloading");
@@ -267,7 +269,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashFirst) {
LoadSecondExtension();
CrashExtension(first_extension_id_);
ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
SCOPED_TRACE("after clicking the balloon");
CheckExtensionConsistency(first_extension_id_);
@@ -280,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsCrashSecond) {
LoadSecondExtension();
CrashExtension(second_extension_id_);
ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
SCOPED_TRACE("after clicking the balloon");
CheckExtensionConsistency(first_extension_id_);
@@ -305,13 +307,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
{
SCOPED_TRACE("first balloon");
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
CheckExtensionConsistency(first_extension_id_);
}
{
SCOPED_TRACE("second balloon");
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
CheckExtensionConsistency(first_extension_id_);
CheckExtensionConsistency(second_extension_id_);
}
@@ -328,13 +330,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, TwoExtensionsOneByOne) {
{
SCOPED_TRACE("first balloon");
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
CheckExtensionConsistency(first_extension_id_);
}
{
SCOPED_TRACE("second balloon");
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
CheckExtensionConsistency(first_extension_id_);
CheckExtensionConsistency(second_extension_id_);
}
@@ -376,8 +378,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
// Accept notification 1 before canceling notification 0.
// Otherwise, on Linux and Windows, there is a race here, in which
// canceled notifications do not immediately go away.
- AcceptNotification(1);
- CancelNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(1));
+ ASSERT_NO_FATAL_FAILURE(CancelNotification(0));
SCOPED_TRACE("balloons done");
ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
@@ -408,7 +410,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
{
SCOPED_TRACE("second: balloon");
- AcceptNotification(0);
+ ASSERT_NO_FATAL_FAILURE(AcceptNotification(0));
CheckExtensionConsistency(first_extension_id_);
CheckExtensionConsistency(second_extension_id_);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698