Index: components/autofill/core/browser/personal_data_manager_unittest.cc |
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc |
index 7d8194ce19a7103d2a346ff27a26e0f474d6656b..1c129de6596861bf1c2b678b6da0225ae7386163 100644 |
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc |
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc |
@@ -5,13 +5,13 @@ |
#include <string> |
#include "base/basictypes.h" |
+#include "base/files/scoped_temp_dir.h" |
#include "base/guid.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/prefs/pref_service.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/synchronization/waitable_event.h" |
-#include "chrome/test/base/testing_profile.h" |
#include "components/autofill/core/browser/autofill_metrics.h" |
#include "components/autofill/core/browser/autofill_profile.h" |
#include "components/autofill/core/browser/autofill_test_utils.h" |
@@ -24,21 +24,17 @@ |
#include "components/autofill/core/common/form_data.h" |
#include "components/webdata/common/web_data_service_base.h" |
#include "components/webdata/common/web_database_service.h" |
-#include "content/public/test/test_browser_thread.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
using base::ASCIIToUTF16; |
-using content::BrowserThread; |
- |
namespace autofill { |
namespace { |
-ACTION(QuitUIMessageLoop) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- base::MessageLoop::current()->Quit(); |
-} |
+enum UserMode { USER_MODE_NORMAL, USER_MODE_INCOGNITO }; |
+ |
+ACTION(QuitMainMessageLoop) { base::MessageLoop::current()->Quit(); } |
class PersonalDataLoadedObserverMock : public PersonalDataManagerObserver { |
public: |
@@ -61,83 +57,57 @@ class TestAutofillMetrics : public AutofillMetrics { |
class PersonalDataManagerTest : public testing::Test { |
protected: |
- PersonalDataManagerTest() |
- : ui_thread_(BrowserThread::UI, &message_loop_), |
- db_thread_(BrowserThread::DB) { |
- } |
+ PersonalDataManagerTest() {} |
virtual void SetUp() { |
- db_thread_.Start(); |
+ prefs_ = test::PrefServiceForTesting(); |
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); |
- web_database_ = new WebDatabaseService( |
- path, |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); |
+ web_database_ = new WebDatabaseService(path, |
+ base::MessageLoopProxy::current(), |
+ base::MessageLoopProxy::current()); |
web_database_->AddTable( |
scoped_ptr<WebDatabaseTable>(new AutofillTable("en-US"))); |
web_database_->LoadDatabase(); |
- autofill_database_service_ = new AutofillWebDataService( |
- web_database_, |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), |
- WebDataServiceBase::ProfileErrorCallback()); |
+ autofill_database_service_ = |
+ new AutofillWebDataService(web_database_, |
+ base::MessageLoopProxy::current(), |
+ base::MessageLoopProxy::current(), |
+ WebDataServiceBase::ProfileErrorCallback()); |
autofill_database_service_->Init(); |
- profile_.reset(new TestingProfile); |
- profile_->CreateWebDataService(); |
- |
- test::DisableSystemServices(profile_.get()); |
- ResetPersonalDataManager(); |
+ test::DisableSystemServices(prefs_.get()); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
} |
virtual void TearDown() { |
// Destruction order is imposed explicitly here. |
personal_data_.reset(NULL); |
- profile_.reset(NULL); |
autofill_database_service_->ShutdownOnUIThread(); |
web_database_->ShutdownDatabase(); |
autofill_database_service_ = NULL; |
web_database_ = NULL; |
- |
- // Schedule another task on the DB thread to notify us that it's safe to |
- // stop the thread. |
- base::WaitableEvent done(false, false); |
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
- base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
- done.Wait(); |
- base::MessageLoop::current()->PostTask(FROM_HERE, |
- base::MessageLoop::QuitClosure()); |
- base::MessageLoop::current()->Run(); |
- db_thread_.Stop(); |
} |
- void ResetPersonalDataManager() { |
+ void ResetPersonalDataManager(UserMode user_mode) { |
+ bool is_incognito = (user_mode == USER_MODE_INCOGNITO); |
personal_data_.reset(new PersonalDataManager("en-US")); |
personal_data_->Init( |
scoped_refptr<AutofillWebDataService>(autofill_database_service_), |
- profile_->GetPrefs(), |
- profile_->IsOffTheRecord()); |
+ prefs_.get(), |
+ is_incognito); |
personal_data_->AddObserver(&personal_data_observer_); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
} |
- void MakeProfileIncognito() { |
- // Switch to an incognito profile. |
- profile_->ForceIncognito(true); |
- DCHECK(profile_->IsOffTheRecord()); |
- } |
- |
base::MessageLoopForUI message_loop_; |
- content::TestBrowserThread ui_thread_; |
- content::TestBrowserThread db_thread_; |
- scoped_ptr<TestingProfile> profile_; |
+ scoped_ptr<PrefService> prefs_; |
scoped_refptr<AutofillWebDataService> autofill_database_service_; |
scoped_refptr<WebDatabaseService> web_database_; |
base::ScopedTempDir temp_dir_; |
@@ -152,7 +122,7 @@ TEST_F(PersonalDataManagerTest, AddProfile) { |
personal_data_->AddProfile(profile0); |
// Reload the database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify the addition. |
const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
@@ -165,7 +135,7 @@ TEST_F(PersonalDataManagerTest, AddProfile) { |
personal_data_->AddProfile(profile0a); |
// Reload the database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify the non-addition. |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -183,7 +153,7 @@ TEST_F(PersonalDataManagerTest, AddProfile) { |
personal_data_->AddProfile(profile1); |
// Reload the database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify the addition. |
const std::vector<AutofillProfile*>& results3 = personal_data_->GetProfiles(); |
@@ -216,8 +186,8 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveProfiles) { |
personal_data_->AddProfile(profile1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
@@ -232,8 +202,8 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveProfiles) { |
personal_data_->AddProfile(profile2); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -244,7 +214,7 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveProfiles) { |
// Reset the PersonalDataManager. This tests that the personal data was saved |
// to the web database, and that we can load the profiles from the web |
// database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify that we've loaded the profiles from the web database. |
const std::vector<AutofillProfile*>& results3 = personal_data_->GetProfiles(); |
@@ -271,8 +241,8 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveCreditCards) { |
personal_data_->AddCreditCard(credit_card1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
@@ -287,8 +257,8 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveCreditCards) { |
personal_data_->AddCreditCard(credit_card2); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
@@ -299,7 +269,7 @@ TEST_F(PersonalDataManagerTest, AddUpdateRemoveCreditCards) { |
// Reset the PersonalDataManager. This tests that the personal data was saved |
// to the web database, and that we can load the credit cards from the web |
// database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify that we've loaded the credit cards from the web database. |
const std::vector<CreditCard*>& results3 = personal_data_->GetCreditCards(); |
@@ -327,8 +297,8 @@ TEST_F(PersonalDataManagerTest, UpdateUnverifiedProfilesAndCreditCards) { |
personal_data_->AddCreditCard(credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& profiles1 = |
@@ -371,8 +341,8 @@ TEST_F(PersonalDataManagerTest, UpdateUnverifiedProfilesAndCreditCards) { |
personal_data_->UpdateCreditCard(credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& profiles3 = |
@@ -412,8 +382,8 @@ TEST_F(PersonalDataManagerTest, AddProfilesAndCreditCards) { |
personal_data_->AddProfile(profile1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
@@ -426,8 +396,8 @@ TEST_F(PersonalDataManagerTest, AddProfilesAndCreditCards) { |
personal_data_->AddCreditCard(credit_card1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
@@ -456,8 +426,8 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { |
personal_data_->AddProfile(profile0); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Verify that we've loaded the profiles from the web database. |
@@ -472,8 +442,8 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { |
personal_data_->AddProfile(profile1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Make sure the two profiles have different GUIDs, both valid. |
@@ -497,7 +467,7 @@ TEST_F(PersonalDataManagerTest, SetEmptyProfile) { |
// Reset the PersonalDataManager. This tests that the personal data was saved |
// to the web database, and that we can load the profiles from the web |
// database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify that we've loaded the profiles from the web database. |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -516,7 +486,7 @@ TEST_F(PersonalDataManagerTest, SetEmptyCreditCard) { |
// Reset the PersonalDataManager. This tests that the personal data was saved |
// to the web database, and that we can load the credit cards from the web |
// database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verify that we've loaded the credit cards from the web database. |
const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
@@ -541,8 +511,8 @@ TEST_F(PersonalDataManagerTest, Refresh) { |
personal_data_->AddProfile(profile1); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
@@ -561,8 +531,8 @@ TEST_F(PersonalDataManagerTest, Refresh) { |
personal_data_->Refresh(); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -586,8 +556,8 @@ TEST_F(PersonalDataManagerTest, Refresh) { |
personal_data_->AddProfile(profile2); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results3 = personal_data_->GetProfiles(); |
@@ -624,8 +594,8 @@ TEST_F(PersonalDataManagerTest, ImportFormData) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -869,8 +839,8 @@ TEST_F(PersonalDataManagerTest, ImportPhoneNumberSplitAcrossMultipleFields) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -916,8 +886,8 @@ TEST_F(PersonalDataManagerTest, ImportFormDataMultilineAddress) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -954,7 +924,7 @@ TEST_F(PersonalDataManagerTest, SetUniqueCreditCardLabels) { |
// Reset the PersonalDataManager. This tests that the personal data was saved |
// to the web database, and that we can load the credit cards from the web |
// database. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
ASSERT_EQ(6U, results.size()); |
@@ -996,8 +966,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1036,8 +1006,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentProfiles) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -1081,8 +1051,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1120,8 +1090,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoProfilesWithMultiValue) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -1174,8 +1144,8 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1224,8 +1194,8 @@ TEST_F(PersonalDataManagerTest, AggregateSameProfileWithConflict) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -1267,8 +1237,8 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { |
EXPECT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1307,8 +1277,8 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInOld) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -1354,8 +1324,8 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1395,8 +1365,8 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithMissingInfoInNew) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -1436,7 +1406,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileWithInsufficientAddress) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); |
ASSERT_EQ(0U, profiles.size()); |
@@ -1523,8 +1493,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentCreditCards) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1555,8 +1525,8 @@ TEST_F(PersonalDataManagerTest, AggregateTwoDifferentCreditCards) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected2(base::GenerateGUID(), "https://www.example.com"); |
@@ -1592,8 +1562,8 @@ TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1624,7 +1594,7 @@ TEST_F(PersonalDataManagerTest, AggregateInvalidCreditCard) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
ASSERT_EQ(1U, results2.size()); |
@@ -1656,8 +1626,8 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1688,8 +1658,8 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithConflict) { |
EXPECT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Expect that the newer information is saved. In this case the year is |
@@ -1727,8 +1697,8 @@ TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1756,7 +1726,7 @@ TEST_F(PersonalDataManagerTest, AggregateEmptyCreditCardWithConflict) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// No change is expected. |
CreditCard expected2(base::GenerateGUID(), "https://www.example.com"); |
@@ -1792,8 +1762,8 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { |
personal_data_->SaveImportedCreditCard(*imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -1823,7 +1793,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// No change is expected. |
CreditCard expected2(base::GenerateGUID(), "https://www.example.com"); |
@@ -1851,7 +1821,7 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInNew) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// No change is expected. |
CreditCard expected3(base::GenerateGUID(), "https://www.example.com"); |
@@ -1871,8 +1841,8 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) { |
personal_data_->AddCreditCard(saved_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
@@ -1903,8 +1873,8 @@ TEST_F(PersonalDataManagerTest, AggregateCreditCardWithMissingInfoInOld) { |
EXPECT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Expect that the newer information is saved. In this case the year is |
@@ -1928,8 +1898,8 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) { |
personal_data_->AddCreditCard(saved_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<CreditCard*>& results1 = personal_data_->GetCreditCards(); |
@@ -1959,7 +1929,7 @@ TEST_F(PersonalDataManagerTest, AggregateSameCreditCardWithSeparators) { |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Expect that no new card is saved. |
const std::vector<CreditCard*>& results2 = personal_data_->GetCreditCards(); |
@@ -1982,8 +1952,8 @@ TEST_F(PersonalDataManagerTest, AggregateExistingVerifiedProfileWithConflict) { |
personal_data_->AddProfile(profile); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Simulate a form submission with conflicting info. |
@@ -2016,8 +1986,8 @@ TEST_F(PersonalDataManagerTest, AggregateExistingVerifiedProfileWithConflict) { |
EXPECT_FALSE(imported_credit_card); |
// Wait for the refresh, which in this case is a no-op. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Expect that no new profile is saved. |
@@ -2040,8 +2010,8 @@ TEST_F(PersonalDataManagerTest, |
personal_data_->AddCreditCard(credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Simulate a form submission with conflicting expiration year. |
@@ -2067,7 +2037,7 @@ TEST_F(PersonalDataManagerTest, |
// Since no refresh is expected, reload the data from the database to make |
// sure no changes were written out. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Expect that the saved credit card is not modified. |
const std::vector<CreditCard*>& results = personal_data_->GetCreditCards(); |
@@ -2090,8 +2060,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfileWithVerifiedData) { |
personal_data_->AddProfile(profile); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile new_verified_profile = profile; |
@@ -2103,8 +2073,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfileWithVerifiedData) { |
personal_data_->SaveImportedProfile(new_verified_profile); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Expect that the existing profile is not modified, and instead the new |
@@ -2129,8 +2099,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfileWithExistingVerifiedData) { |
personal_data_->AddProfile(profile); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile new_verified_profile = profile; |
@@ -2142,8 +2112,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfileWithExistingVerifiedData) { |
personal_data_->SaveImportedProfile(new_verified_profile); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// The new profile should be merged into the existing one. |
@@ -2171,8 +2141,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedCreditCardWithVerifiedData) { |
personal_data_->AddCreditCard(credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
CreditCard new_verified_card = credit_card; |
@@ -2183,8 +2153,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedCreditCardWithVerifiedData) { |
personal_data_->SaveImportedCreditCard(new_verified_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// Expect that the saved credit card is updated. |
@@ -2209,8 +2179,8 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { |
personal_data_->AddProfile(profile0); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
personal_data_->GetNonEmptyTypes(&non_empty_types); |
@@ -2248,8 +2218,8 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { |
personal_data_->AddProfile(profile2); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
personal_data_->GetNonEmptyTypes(&non_empty_types); |
@@ -2282,8 +2252,8 @@ TEST_F(PersonalDataManagerTest, GetNonEmptyTypes) { |
personal_data_->AddCreditCard(credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
personal_data_->GetNonEmptyTypes(&non_empty_types); |
@@ -2352,8 +2322,8 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
@@ -2395,8 +2365,8 @@ TEST_F(PersonalDataManagerTest, CaseInsensitiveMultiValueAggregation) { |
ASSERT_FALSE(imported_credit_card); |
// Verify that the web database has been updated and the notification sent. |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
@@ -2426,11 +2396,9 @@ TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
&bill_gates, "William H. Gates", "5555555555554444", "1", "2020"); |
personal_data_->AddCreditCard(bill_gates); |
- MakeProfileIncognito(); |
- |
// The personal data manager should be able to read existing profiles in an |
// off-the-record context. |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_INCOGNITO); |
ASSERT_EQ(1U, personal_data_->GetProfiles().size()); |
ASSERT_EQ(1U, personal_data_->GetCreditCards().size()); |
@@ -2445,7 +2413,7 @@ TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
&larry_page, "Lawrence Page", "4111111111111111", "10", "2025"); |
personal_data_->AddCreditCard(larry_page); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_INCOGNITO); |
EXPECT_EQ(1U, personal_data_->GetProfiles().size()); |
EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); |
@@ -2456,7 +2424,7 @@ TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); |
personal_data_->SaveImportedCreditCard(bill_gates); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_INCOGNITO); |
EXPECT_EQ(ASCIIToUTF16("Steven"), |
personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); |
EXPECT_EQ(ASCIIToUTF16("William H. Gates"), |
@@ -2469,7 +2437,7 @@ TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
bill_gates.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Bill Gates")); |
personal_data_->UpdateCreditCard(bill_gates); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_INCOGNITO); |
EXPECT_EQ(ASCIIToUTF16("Steven"), |
personal_data_->GetProfiles()[0]->GetRawInfo(NAME_FIRST)); |
EXPECT_EQ(ASCIIToUTF16("William H. Gates"), |
@@ -2479,7 +2447,7 @@ TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
personal_data_->RemoveByGUID(steve_jobs.guid()); |
personal_data_->RemoveByGUID(bill_gates.guid()); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_INCOGNITO); |
EXPECT_EQ(1U, personal_data_->GetProfiles().size()); |
EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); |
} |
@@ -2495,8 +2463,8 @@ TEST_F(PersonalDataManagerTest, DefaultCountryCodeIsCached) { |
"", "1 Taiga TKTR", "", "Calgary", "AB", "T2B 2K2", |
"CA", "(800) 555-9000"); |
personal_data_->AddProfile(moose); |
- EXPECT_CALL(personal_data_observer_, |
- OnPersonalDataChanged()).WillOnce(QuitUIMessageLoop()); |
+ EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
+ .WillOnce(QuitMainMessageLoop()); |
base::MessageLoop::current()->Run(); |
// The value is cached and doesn't change even after adding an address. |
EXPECT_EQ(default_country, |
@@ -2506,13 +2474,13 @@ TEST_F(PersonalDataManagerTest, DefaultCountryCodeIsCached) { |
// Disabling Autofill blows away this cache and shouldn't account for Autofill |
// profiles. |
- profile_->GetPrefs()->SetBoolean(prefs::kAutofillEnabled, false); |
+ prefs_->SetBoolean(prefs::kAutofillEnabled, false); |
EXPECT_EQ(default_country, |
personal_data_->GetDefaultCountryCodeForNewAddress()); |
// Enabling Autofill blows away the cached value and should reflect the new |
// value (accounting for profiles). |
- profile_->GetPrefs()->SetBoolean(prefs::kAutofillEnabled, true); |
+ prefs_->SetBoolean(prefs::kAutofillEnabled, true); |
EXPECT_EQ(base::UTF16ToUTF8(moose.GetRawInfo(ADDRESS_HOME_COUNTRY)), |
personal_data_->GetDefaultCountryCodeForNewAddress()); |
} |
@@ -2523,7 +2491,7 @@ TEST_F(PersonalDataManagerTest, DefaultCountryCodeComesFromProfiles) { |
"", "1 Taiga TKTR", "", "Calgary", "AB", "T2B 2K2", |
"CA", "(800) 555-9000"); |
personal_data_->AddProfile(moose); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
EXPECT_EQ("CA", personal_data_->GetDefaultCountryCodeForNewAddress()); |
// Multiple profiles cast votes. |
@@ -2537,26 +2505,26 @@ TEST_F(PersonalDataManagerTest, DefaultCountryCodeComesFromProfiles) { |
"MX", "(800) 555-9000"); |
personal_data_->AddProfile(armadillo); |
personal_data_->AddProfile(armadillo2); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); |
personal_data_->RemoveByGUID(armadillo.guid()); |
personal_data_->RemoveByGUID(armadillo2.guid()); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// Verified profiles count more. |
armadillo.set_origin("http://randomwebsite.com"); |
armadillo2.set_origin("http://randomwebsite.com"); |
personal_data_->AddProfile(armadillo); |
personal_data_->AddProfile(armadillo2); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
EXPECT_EQ("CA", personal_data_->GetDefaultCountryCodeForNewAddress()); |
personal_data_->RemoveByGUID(armadillo.guid()); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
// But unverified profiles can be a tie breaker. |
armadillo.set_origin("Chrome settings"); |
personal_data_->AddProfile(armadillo); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); |
// Invalid country codes are ignored. |
@@ -2567,7 +2535,7 @@ TEST_F(PersonalDataManagerTest, DefaultCountryCodeComesFromProfiles) { |
"mm@example.com", "", "1 Flying Object", "", "Valles Marineris", "", |
"", "XX", ""); |
personal_data_->AddProfile(moose); |
- ResetPersonalDataManager(); |
+ ResetPersonalDataManager(USER_MODE_NORMAL); |
EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); |
} |