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

Unified Diff: chrome/browser/protector/protector_service_browsertest.cc

Issue 10825085: Move RunAllPendingInMessageLoop from ui_test_utils.h to test_utils.h, so that it can be reused by c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/protector/protector_service_browsertest.cc
===================================================================
--- chrome/browser/protector/protector_service_browsertest.cc (revision 149002)
+++ chrome/browser/protector/protector_service_browsertest.cc (working copy)
@@ -73,7 +73,7 @@
WillOnce(Return(false));
protector_service_->ShowChange(mock_change_);
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -83,11 +83,11 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
protector_service_->DismissChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -97,11 +97,11 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_CALL(*mock_change_, Apply(browser()));
protector_service_->ApplyChange(mock_change_, browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
}
@@ -118,7 +118,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_CALL(*mock_change_, Apply(browser()));
// Pressing Cancel applies the change.
@@ -126,7 +126,7 @@
ASSERT_TRUE(error);
error->BubbleViewCancelButtonPressed(browser());
error->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
}
@@ -135,11 +135,11 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_CALL(*mock_change_, Discard(browser()));
protector_service_->DiscardChange(mock_change_, browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
}
@@ -148,7 +148,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_CALL(*mock_change_, Discard(browser()));
// Pressing Apply discards the change.
@@ -156,7 +156,7 @@
ASSERT_TRUE(error);
error->BubbleViewAcceptButtonPressed(browser());
error->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
}
@@ -164,7 +164,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
GlobalError* error = GetGlobalError(mock_change_);
@@ -175,7 +175,7 @@
bubble_view, &GlobalErrorBubbleViewBase::CloseBubbleView));
// Pressing Cancel applies the change.
error->BubbleViewCancelButtonPressed(browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
}
@@ -184,7 +184,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -195,7 +195,7 @@
WillOnce(Return(true));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(false));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
EXPECT_EQ(mock_change2, protector_service_->GetLastChange());
@@ -203,7 +203,7 @@
// Apply the first change, the second should still be active.
EXPECT_CALL(*mock_change_, Apply(browser()));
protector_service_->ApplyChange(mock_change_, browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
EXPECT_EQ(mock_change2, protector_service_->GetLastChange());
@@ -211,7 +211,7 @@
// Finally apply the second change.
EXPECT_CALL(*mock_change2, Apply(browser()));
protector_service_->ApplyChange(mock_change2, browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_FALSE(IsGlobalErrorActive(mock_change2));
EXPECT_FALSE(protector_service_->GetLastChange());
@@ -223,7 +223,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
// ProtectService will own this change instance as well.
@@ -233,20 +233,20 @@
WillOnce(Return(true));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(false));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
// Dismiss the first change, the second should still be active.
protector_service_->DismissChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
// Finally apply the second change.
EXPECT_CALL(*mock_change2, Apply(browser()));
protector_service_->ApplyChange(mock_change2, browser());
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_FALSE(IsGlobalErrorActive(mock_change2));
}
@@ -257,7 +257,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
// The first bubble view has been displayed.
@@ -272,7 +272,7 @@
WillOnce(Return(true));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(false));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
@@ -287,7 +287,7 @@
EXPECT_CALL(*mock_change_, Apply(browser()));
error->BubbleViewCancelButtonPressed(browser());
error->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
@@ -298,7 +298,7 @@
EXPECT_CALL(*mock_change2, Apply(browser()));
error2->BubbleViewCancelButtonPressed(browser());
error2->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
EXPECT_FALSE(IsGlobalErrorActive(mock_change2));
}
@@ -309,7 +309,7 @@
EXPECT_CALL(*mock_change_, MockInit(browser()->profile())).
WillOnce(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
// The first bubble view has been displayed.
@@ -321,7 +321,7 @@
EXPECT_CALL(*mock_change_, Apply(browser()));
error->BubbleViewCancelButtonPressed(browser());
error->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
// ProtectService will own this change instance as well.
@@ -331,7 +331,7 @@
WillOnce(Return(true));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(false));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change2));
// The second bubble view has been displayed.
@@ -343,7 +343,7 @@
EXPECT_CALL(*mock_change2, Apply(browser()));
error2->BubbleViewCancelButtonPressed(browser());
error2->GetBubbleView()->CloseBubbleView();
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change2));
}
@@ -357,7 +357,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -369,7 +369,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url2));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Both changes are shown separately, not composited.
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
@@ -378,7 +378,7 @@
protector_service_->DismissChange(mock_change_);
protector_service_->DismissChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -391,7 +391,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -408,7 +408,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Now ProtectorService should be showing a single composite change.
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
@@ -424,7 +424,7 @@
EXPECT_TRUE(error2->HasShownBubbleView());
protector_service_->DismissChange(composite_change);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(composite_change));
EXPECT_FALSE(protector_service_->GetLastChange());
@@ -435,14 +435,14 @@
EXPECT_CALL(*mock_change3, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change3, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change3);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// The third change should not be composed with the previous.
EXPECT_TRUE(IsGlobalErrorActive(mock_change3));
EXPECT_EQ(mock_change3, protector_service_->GetLastChange());
protector_service_->DismissChange(mock_change3);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change3));
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -457,7 +457,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -469,7 +469,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Now ProtectorService should be showing a single composite change.
BaseSettingChange* composite_change = protector_service_->GetLastChange();
@@ -483,7 +483,7 @@
EXPECT_CALL(*mock_change3, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change3, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change3);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// The third change should be composed with the previous.
EXPECT_FALSE(IsGlobalErrorActive(mock_change3));
@@ -497,7 +497,7 @@
EXPECT_CALL(*mock_change4, GetNewSettingURL()).WillRepeatedly(Return(url2));
EXPECT_CALL(*mock_change4, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change4);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// The 4th change is shown independently.
EXPECT_TRUE(IsGlobalErrorActive(composite_change));
@@ -506,7 +506,7 @@
protector_service_->DismissChange(composite_change);
protector_service_->DismissChange(mock_change4);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(composite_change));
EXPECT_FALSE(IsGlobalErrorActive(mock_change4));
EXPECT_FALSE(protector_service_->GetLastChange());
@@ -522,7 +522,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -534,7 +534,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Now ProtectorService should be showing a single composite change.
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
@@ -551,7 +551,7 @@
EXPECT_CALL(*mock_change3, GetNewSettingURL()).WillRepeatedly(Return(url2));
EXPECT_CALL(*mock_change3, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change3);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// The third change should not be composed with the previous.
EXPECT_TRUE(IsGlobalErrorActive(mock_change3));
@@ -560,7 +560,7 @@
// Now dismiss the first change.
protector_service_->DismissChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// This should effectively dismiss the whole composite change.
EXPECT_FALSE(IsGlobalErrorActive(composite_change));
@@ -568,7 +568,7 @@
EXPECT_EQ(mock_change3, protector_service_->GetLastChange());
protector_service_->DismissChange(mock_change3);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(mock_change3));
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -584,7 +584,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -596,7 +596,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url2));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Changes should be merged.
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
@@ -607,7 +607,7 @@
EXPECT_TRUE(IsGlobalErrorActive(composite_change));
protector_service_->DismissChange(composite_change);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(composite_change));
EXPECT_FALSE(protector_service_->GetLastChange());
}
@@ -623,7 +623,7 @@
EXPECT_CALL(*mock_change_, GetNewSettingURL()).WillRepeatedly(Return(url1));
EXPECT_CALL(*mock_change_, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change_);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_TRUE(IsGlobalErrorActive(mock_change_));
EXPECT_EQ(mock_change_, protector_service_->GetLastChange());
@@ -635,7 +635,7 @@
EXPECT_CALL(*mock_change2, GetNewSettingURL()).WillRepeatedly(Return(url2));
EXPECT_CALL(*mock_change2, CanBeMerged()).WillRepeatedly(Return(true));
protector_service_->ShowChange(mock_change2);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
// Changes should be merged.
EXPECT_FALSE(IsGlobalErrorActive(mock_change_));
@@ -646,7 +646,7 @@
EXPECT_TRUE(IsGlobalErrorActive(composite_change));
protector_service_->DismissChange(composite_change);
- ui_test_utils::RunAllPendingInMessageLoop();
+ content::RunAllPendingInMessageLoop();
EXPECT_FALSE(IsGlobalErrorActive(composite_change));
EXPECT_FALSE(protector_service_->GetLastChange());
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_browsertest.cc ('k') | chrome/browser/sync/test/integration/sessions_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698