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

Unified Diff: components/password_manager/core/browser/password_store_default_unittest.cc

Issue 2053913002: Remove MessageLoop::current()->RunUntilIdle() in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: components/password_manager/core/browser/password_store_default_unittest.cc
diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc
index fa6e1b196c888b3d341283d28307dd5104c0178a..9648d2accd417fda453cd0ddef155f04cc40b283 100644
--- a/components/password_manager/core/browser/password_store_default_unittest.cc
+++ b/components/password_manager/core/browser/password_store_default_unittest.cc
@@ -123,7 +123,7 @@ PasswordStoreDefaultTestDelegate::~PasswordStoreDefaultTestDelegate() {
}
void PasswordStoreDefaultTestDelegate::FinishAsyncProcessing() {
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
void PasswordStoreDefaultTestDelegate::SetupTempDir() {
@@ -132,7 +132,7 @@ void PasswordStoreDefaultTestDelegate::SetupTempDir() {
void PasswordStoreDefaultTestDelegate::ClosePasswordStore() {
store_->ShutdownOnUIThread();
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_TRUE(temp_dir_.Delete());
}
@@ -188,7 +188,7 @@ TEST(PasswordStoreDefaultTest, NonASCIIData) {
store->AddLogin(*expected_forms.back());
}
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
MockPasswordStoreConsumer consumer;
@@ -198,7 +198,7 @@ TEST(PasswordStoreDefaultTest, NonASCIIData) {
expected_forms.get())));
store->GetAutofillableLogins(&consumer);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
TEST(PasswordStoreDefaultTest, Notifications) {
@@ -220,7 +220,7 @@ TEST(PasswordStoreDefaultTest, Notifications) {
// Adding a login should trigger a notification.
store->AddLogin(*form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Change the password.
form->password_value = base::ASCIIToUTF16("a different password");
@@ -234,7 +234,7 @@ TEST(PasswordStoreDefaultTest, Notifications) {
// Updating the login with the new password should trigger a notification.
store->UpdateLogin(*form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
const PasswordStoreChange expected_delete_changes[] = {
PasswordStoreChange(PasswordStoreChange::REMOVE, *form),
@@ -245,7 +245,7 @@ TEST(PasswordStoreDefaultTest, Notifications) {
// Deleting the login should trigger a notification.
store->RemoveLogin(*form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
store->RemoveObserver(&observer);
}
@@ -257,7 +257,7 @@ TEST(PasswordStoreDefaultTest, OperationsOnABadDatabaseSilentlyFail) {
PasswordStoreDefaultTestDelegate delegate(
base::WrapUnique(new BadLoginDatabase));
PasswordStoreDefault* bad_store = delegate.store();
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
ASSERT_EQ(nullptr, bad_store->login_db());
testing::StrictMock<MockPasswordStoreObserver> mock_observer;
@@ -273,41 +273,41 @@ TEST(PasswordStoreDefaultTest, OperationsOnABadDatabaseSilentlyFail) {
blacklisted_form->blacklisted_by_user = true;
bad_store->AddLogin(*form);
bad_store->AddLogin(*blacklisted_form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Get all logins; autofillable logins; blacklisted logins.
testing::StrictMock<MockPasswordStoreConsumer> mock_consumer;
EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(IsEmpty()));
bad_store->GetLogins(*form, &mock_consumer);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
testing::Mock::VerifyAndClearExpectations(&mock_consumer);
EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(IsEmpty()));
bad_store->GetAutofillableLogins(&mock_consumer);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
testing::Mock::VerifyAndClearExpectations(&mock_consumer);
EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(IsEmpty()));
bad_store->GetBlacklistLogins(&mock_consumer);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Report metrics.
bad_store->ReportMetrics("Test Username", true);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Change the login.
form->password_value = base::ASCIIToUTF16("a different password");
bad_store->UpdateLogin(*form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Delete one login; a range of logins.
bad_store->RemoveLogin(*form);
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
base::RunLoop run_loop;
bad_store->RemoveLoginsCreatedBetween(base::Time(), base::Time::Max(),
run_loop.QuitClosure());
run_loop.Run();
bad_store->RemoveLoginsSyncedBetween(base::Time(), base::Time::Max());
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Ensure no notifications and no explosions during shutdown either.
bad_store->RemoveObserver(&mock_observer);

Powered by Google App Engine
This is Rietveld 408576698