Index: chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc |
diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc |
index ee2c5694c34665b212120d00cea9ca68d4982eeb..3cf45bb1351f3c186e98c6e1ffb2fa791d1dad01 100644 |
--- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc |
+++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc |
@@ -1,3 +1,4 @@ |
+ |
// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -7,7 +8,6 @@ |
#include "chrome/browser/sync/test/integration/autofill_helper.h" |
#include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
-#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
#include "chrome/browser/sync/test/integration/sync_test.h" |
#include "components/autofill/core/browser/autofill_profile.h" |
#include "components/autofill/core/browser/credit_card.h" |
@@ -15,7 +15,6 @@ |
#include "components/autofill/core/browser/webdata/autofill_entry.h" |
#include "components/autofill/core/browser/webdata/autofill_table.h" |
- |
using autofill::AutofillKey; |
using autofill::AutofillTable; |
using autofill::AutofillProfile; |
@@ -24,8 +23,6 @@ using autofill::CreditCard; |
using autofill::PersonalDataManager; |
using autofill_helper::AddKeys; |
using autofill_helper::AddProfile; |
-using autofill_helper::AwaitKeysMatch; |
-using autofill_helper::AwaitProfilesMatch; |
using autofill_helper::CreateAutofillProfile; |
using autofill_helper::CreateUniqueAutofillProfile; |
using autofill_helper::GetAllAutoFillProfiles; |
@@ -46,7 +43,6 @@ using bookmarks_helper::AddFolder; |
using bookmarks_helper::AddURL; |
using bookmarks_helper::IndexedURL; |
using bookmarks_helper::IndexedURLTitle; |
-using sync_integration_test_util::AwaitCommitActivityCompletion; |
class TwoClientAutofillSyncTest : public SyncTest { |
public: |
@@ -75,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { |
keys.insert(AutofillKey("name0", "value0")); |
AddKeys(0, keys); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllKeys(0).size()); |
// Client1 adds a key. |
@@ -83,7 +79,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { |
keys.insert(AutofillKey("name1", "value1-0")); |
AddKeys(1, keys); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(2U, GetAllKeys(0).size()); |
// Client0 adds a key with the same name. |
@@ -91,20 +87,20 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { |
keys.insert(AutofillKey("name1", "value1-1")); |
AddKeys(0, keys); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(3U, GetAllKeys(0).size()); |
// Client1 removes a key. |
RemoveKey(1, AutofillKey("name1", "value1-0")); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(2U, GetAllKeys(0).size()); |
// Client0 removes the rest. |
RemoveKey(0, AutofillKey("name0", "value0")); |
RemoveKey(0, AutofillKey("name1", "value1-1")); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(0U, GetAllKeys(0).size()); |
} |
@@ -117,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { |
base::WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
AddKeys(0, keys); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
} |
IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
@@ -130,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
keys.insert(AutofillKey("name1", "value1")); |
AddKeys(0, keys); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(2U, GetAllKeys(0).size()); |
} |
@@ -150,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
AddKeys(1, keys1); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
+ ASSERT_TRUE(AutofillKeysChecker(0, 1).Wait()); |
ASSERT_EQ(5U, GetAllKeys(0).size()); |
} |
@@ -161,25 +157,25 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
// Client0 adds a profile. |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
// Client1 adds a profile. |
AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(2U, GetAllAutoFillProfiles(0).size()); |
// Client0 adds the same profile. |
AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(2U, GetAllAutoFillProfiles(0).size()); |
// Client1 removes a profile. |
RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid()); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
// Client0 updates a profile. |
@@ -188,13 +184,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
AutofillType(autofill::NAME_FIRST), |
base::ASCIIToUTF16("Bart")); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
// Client1 removes remaining profile. |
RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid()); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -205,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -221,7 +217,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { |
AddProfile(0, profile0); |
AddProfile(1, profile1); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -230,7 +226,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -240,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -252,7 +248,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { |
AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(3U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -262,12 +258,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid()); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -279,7 +275,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { |
AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(3U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -289,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
UpdateProfile(0, |
@@ -301,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { |
AutofillType(autofill::EMAIL_ADDRESS), |
base::ASCIIToUTF16("grrrl@TV.com")); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -311,7 +307,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
UpdateProfile(0, |
GetAllAutoFillProfiles(0)[0]->guid(), |
@@ -323,7 +319,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { |
AutofillType(autofill::NAME_FIRST), |
base::ASCIIToUTF16("Bart")); |
MakeABookmarkChange(1); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
} |
@@ -333,7 +329,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
base::string16 max_length_string(AutofillTable::kMaxDataLength, '.'); |
@@ -351,7 +347,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { |
max_length_string); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
} |
IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { |
@@ -359,7 +355,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { |
AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
base::string16 exceeds_max_length_string( |
@@ -382,7 +378,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { |
exceeds_max_length_string); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(bookmarks_helper::AwaitAllModelsMatch()); |
+ ASSERT_TRUE(BookmarksMatchChecker().Wait()); |
EXPECT_FALSE(ProfilesMatch(0, 1)); |
} |
@@ -400,7 +396,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { |
SetCreditCards(0, &credit_cards); |
MakeABookmarkChange(0); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size()); |
PersonalDataManager* pdm = GetPersonalDataManager(1); |
@@ -412,8 +408,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
// All profiles should sync same autofill profiles. |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)) << |
- "Initial autofill profiles did not match for all profiles."; |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()) |
+ << "Initial autofill profiles did not match for all profiles."; |
// For clean profiles, the autofill profiles count should be zero. We are not |
// enforcing this, we only check that the final count is equal to initial |
@@ -423,7 +419,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
// Add a new autofill profile to the first client. |
AddProfile(0, CreateUniqueAutofillProfile()); |
- ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
+ ASSERT_TRUE(AutofillProfileChecker(0, 1).Wait()); |
// Check that the total number of autofill profiles is as expected |
for (int i = 0; i < num_clients(); ++i) { |