| Index: components/autofill/core/browser/webdata/web_data_service_unittest.cc
|
| diff --git a/components/autofill/core/browser/webdata/web_data_service_unittest.cc b/components/autofill/core/browser/webdata/web_data_service_unittest.cc
|
| index bfcafe166bc97d2174d7b7f958bcdfb2bd1aa11b..ff255507e941ee6a368e4f8a8a447e1c8853a4ee 100644
|
| --- a/components/autofill/core/browser/webdata/web_data_service_unittest.cc
|
| +++ b/components/autofill/core/browser/webdata/web_data_service_unittest.cc
|
| @@ -12,6 +12,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/run_loop.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/stl_util.h"
|
| #include "base/strings/string16.h"
|
| @@ -122,7 +123,7 @@ class WebDataServiceTest : public testing::Test {
|
|
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| db_thread_.Stop();
|
| }
|
|
|
| @@ -226,7 +227,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) {
|
| name1_, base::string16(), limit, &consumer);
|
|
|
| // The message loop will exit when the consumer is called.
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
|
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(1U, consumer.result().size());
|
| @@ -303,7 +304,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileAdd) {
|
| // Check that it was added.
|
| AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(1U, consumer.result().size());
|
| EXPECT_EQ(profile, *consumer.result()[0]);
|
| @@ -322,7 +323,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) {
|
| // Check that it was added.
|
| AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(1U, consumer.result().size());
|
| EXPECT_EQ(profile, *consumer.result()[0]);
|
| @@ -341,7 +342,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) {
|
| // Check that it was removed.
|
| AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer2;
|
| WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, consumer2.handle());
|
| ASSERT_EQ(0U, consumer2.result().size());
|
| }
|
| @@ -366,7 +367,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
|
| // Check that they were added.
|
| AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetAutofillProfiles(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(2U, consumer.result().size());
|
| EXPECT_EQ(profile2, *consumer.result()[0]);
|
| @@ -388,7 +389,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
|
| // Check that the updates were made.
|
| AutofillWebDataServiceConsumer<std::vector<AutofillProfile*> > consumer2;
|
| WebDataServiceBase::Handle handle2 = wds_->GetAutofillProfiles(&consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, consumer2.handle());
|
| ASSERT_EQ(2U, consumer2.result().size());
|
| EXPECT_EQ(profile2_changed, *consumer2.result()[0]);
|
| @@ -405,7 +406,7 @@ TEST_F(WebDataServiceAutofillTest, CreditAdd) {
|
| // Check that it was added.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(1U, consumer.result().size());
|
| EXPECT_EQ(card, *consumer.result()[0]);
|
| @@ -422,7 +423,7 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) {
|
| // Check that it was added.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(1U, consumer.result().size());
|
| EXPECT_EQ(credit_card, *consumer.result()[0]);
|
| @@ -435,7 +436,7 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) {
|
| // Check that it was removed.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > consumer2;
|
| WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, consumer2.handle());
|
| ASSERT_EQ(0U, consumer2.result().size());
|
| }
|
| @@ -455,7 +456,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) {
|
| // Check that they got added.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > consumer;
|
| WebDataServiceBase::Handle handle = wds_->GetCreditCards(&consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, consumer.handle());
|
| ASSERT_EQ(2U, consumer.result().size());
|
| EXPECT_EQ(card2, *consumer.result()[0]);
|
| @@ -471,7 +472,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) {
|
| // Check that the updates were made.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > consumer2;
|
| WebDataServiceBase::Handle handle2 = wds_->GetCreditCards(&consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, consumer2.handle());
|
| ASSERT_EQ(2U, consumer2.result().size());
|
| EXPECT_NE(card2, *consumer2.result()[0]);
|
| @@ -493,7 +494,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
|
| profile_consumer;
|
| WebDataServiceBase::Handle handle =
|
| wds_->GetAutofillProfiles(&profile_consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, profile_consumer.handle());
|
| ASSERT_EQ(1U, profile_consumer.result().size());
|
| EXPECT_EQ(profile, *profile_consumer.result()[0]);
|
| @@ -507,7 +508,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
|
| // Check that it was added.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > card_consumer;
|
| handle = wds_->GetCreditCards(&card_consumer);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle, card_consumer.handle());
|
| ASSERT_EQ(1U, card_consumer.result().size());
|
| EXPECT_EQ(credit_card, *card_consumer.result()[0]);
|
| @@ -529,14 +530,14 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) {
|
| profile_consumer2;
|
| WebDataServiceBase::Handle handle2 =
|
| wds_->GetAutofillProfiles(&profile_consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, profile_consumer2.handle());
|
| ASSERT_EQ(0U, profile_consumer2.result().size());
|
|
|
| // Check that the credit card was removed.
|
| AutofillWebDataServiceConsumer<std::vector<CreditCard*> > card_consumer2;
|
| handle2 = wds_->GetCreditCards(&card_consumer2);
|
| - base::MessageLoop::current()->Run();
|
| + base::RunLoop().Run();
|
| EXPECT_EQ(handle2, card_consumer2.handle());
|
| ASSERT_EQ(0U, card_consumer2.result().size());
|
| }
|
|
|