| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/sync/test/integration/autofill_helper.h" | 6 #include "chrome/browser/sync/test/integration/autofill_helper.h" |
| 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" | 9 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 11 #include "components/autofill/core/browser/autofill_profile.h" | 11 #include "components/autofill/core/browser/autofill_profile.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "components/autofill/core/browser/personal_data_manager.h" | 13 #include "components/autofill/core/browser/personal_data_manager.h" |
| 14 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 14 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
| 15 #include "components/autofill/core/browser/webdata/autofill_table.h" | 15 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| 16 | 16 |
| 17 using autofill::AutofillKey; | 17 using autofill::AutofillKey; |
| 18 using autofill::AutofillTable; | 18 using autofill::AutofillTable; |
| 19 using autofill::AutofillProfile; | 19 using autofill::AutofillProfile; |
| 20 using autofill::AutofillType; | 20 using autofill::AutofillType; |
| 21 using autofill::CreditCard; | 21 using autofill::CreditCard; |
| 22 using autofill::PersonalDataManager; | 22 using autofill::PersonalDataManager; |
| 23 using autofill_helper::AddKeys; | 23 using autofill_helper::AddKeys; |
| 24 using autofill_helper::AddProfile; | 24 using autofill_helper::AddProfile; |
| 25 using autofill_helper::AwaitKeysMatch; |
| 26 using autofill_helper::AwaitProfilesMatch; |
| 25 using autofill_helper::CreateAutofillProfile; | 27 using autofill_helper::CreateAutofillProfile; |
| 26 using autofill_helper::GetAllKeys; | 28 using autofill_helper::GetAllKeys; |
| 27 using autofill_helper::GetAllProfiles; | 29 using autofill_helper::GetAllProfiles; |
| 28 using autofill_helper::GetPersonalDataManager; | 30 using autofill_helper::GetPersonalDataManager; |
| 29 using autofill_helper::KeysMatch; | 31 using autofill_helper::KeysMatch; |
| 30 using autofill_helper::ProfilesMatch; | 32 using autofill_helper::ProfilesMatch; |
| 31 using autofill_helper::PROFILE_FRASIER; | 33 using autofill_helper::PROFILE_FRASIER; |
| 32 using autofill_helper::PROFILE_HOMER; | 34 using autofill_helper::PROFILE_HOMER; |
| 33 using autofill_helper::PROFILE_MARION; | 35 using autofill_helper::PROFILE_MARION; |
| 34 using autofill_helper::PROFILE_NULL; | 36 using autofill_helper::PROFILE_NULL; |
| 35 using autofill_helper::RemoveKey; | 37 using autofill_helper::RemoveKey; |
| 36 using autofill_helper::RemoveProfile; | 38 using autofill_helper::RemoveProfile; |
| 37 using autofill_helper::SetCreditCards; | 39 using autofill_helper::SetCreditCards; |
| 38 using autofill_helper::UpdateProfile; | 40 using autofill_helper::UpdateProfile; |
| 39 using bookmarks_helper::AddFolder; | 41 using bookmarks_helper::AddFolder; |
| 40 using bookmarks_helper::AddURL; | 42 using bookmarks_helper::AddURL; |
| 41 using bookmarks_helper::IndexedURL; | 43 using bookmarks_helper::IndexedURL; |
| 42 using bookmarks_helper::IndexedURLTitle; | 44 using bookmarks_helper::IndexedURLTitle; |
| 43 using sync_integration_test_util::AwaitCommitActivityCompletion; | 45 using sync_integration_test_util::AwaitCommitActivityCompletion; |
| 44 | 46 |
| 45 class TwoClientAutofillSyncTest : public SyncTest { | 47 class TwoClientAutofillSyncTest : public SyncTest { |
| 46 public: | 48 public: |
| 47 TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; } | 49 TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; } |
| 48 virtual ~TwoClientAutofillSyncTest() {} | 50 virtual ~TwoClientAutofillSyncTest() {} |
| 49 | 51 |
| 52 virtual bool TestUsesSelfNotifications() OVERRIDE { return false; } |
| 53 |
| 50 // We do this so as to make a change that will trigger the autofill to sync. | 54 // We do this so as to make a change that will trigger the autofill to sync. |
| 51 // By default autofill does not sync unless there is some other change. | 55 // By default autofill does not sync unless there is some other change. |
| 52 void MakeABookmarkChange(int profile) { | 56 void MakeABookmarkChange(int profile) { |
| 53 ASSERT_TRUE( | 57 ASSERT_TRUE( |
| 54 AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count)))); | 58 AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count)))); |
| 55 ++count; | 59 ++count; |
| 56 } | 60 } |
| 57 private: | 61 private: |
| 58 int count; | 62 int count; |
| 59 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); | 63 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { | 66 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { |
| 63 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 64 | 68 |
| 65 // Client0 adds a key. | 69 // Client0 adds a key. |
| 66 std::set<AutofillKey> keys; | 70 std::set<AutofillKey> keys; |
| 67 keys.insert(AutofillKey("name0", "value0")); | 71 keys.insert(AutofillKey("name0", "value0")); |
| 68 AddKeys(0, keys); | 72 AddKeys(0, keys); |
| 69 MakeABookmarkChange(0); | 73 MakeABookmarkChange(0); |
| 70 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 74 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 71 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 72 ASSERT_EQ(1U, GetAllKeys(0).size()); | 75 ASSERT_EQ(1U, GetAllKeys(0).size()); |
| 73 | 76 |
| 74 // Client1 adds a key. | 77 // Client1 adds a key. |
| 75 keys.clear(); | 78 keys.clear(); |
| 76 keys.insert(AutofillKey("name1", "value1-0")); | 79 keys.insert(AutofillKey("name1", "value1-0")); |
| 77 AddKeys(1, keys); | 80 AddKeys(1, keys); |
| 78 MakeABookmarkChange(1); | 81 MakeABookmarkChange(1); |
| 79 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 82 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 80 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 81 ASSERT_EQ(2U, GetAllKeys(0).size()); | 83 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 82 | 84 |
| 83 // Client0 adds a key with the same name. | 85 // Client0 adds a key with the same name. |
| 84 keys.clear(); | 86 keys.clear(); |
| 85 keys.insert(AutofillKey("name1", "value1-1")); | 87 keys.insert(AutofillKey("name1", "value1-1")); |
| 86 AddKeys(0, keys); | 88 AddKeys(0, keys); |
| 87 MakeABookmarkChange(0); | 89 MakeABookmarkChange(0); |
| 88 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 90 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 89 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 90 ASSERT_EQ(3U, GetAllKeys(0).size()); | 91 ASSERT_EQ(3U, GetAllKeys(0).size()); |
| 91 | 92 |
| 92 // Client1 removes a key. | 93 // Client1 removes a key. |
| 93 RemoveKey(1, AutofillKey("name1", "value1-0")); | 94 RemoveKey(1, AutofillKey("name1", "value1-0")); |
| 94 MakeABookmarkChange(1); | 95 MakeABookmarkChange(1); |
| 95 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 96 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 96 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 97 ASSERT_EQ(2U, GetAllKeys(0).size()); | 97 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 98 | 98 |
| 99 // Client0 removes the rest. | 99 // Client0 removes the rest. |
| 100 RemoveKey(0, AutofillKey("name0", "value0")); | 100 RemoveKey(0, AutofillKey("name0", "value0")); |
| 101 RemoveKey(0, AutofillKey("name1", "value1-1")); | 101 RemoveKey(0, AutofillKey("name1", "value1-1")); |
| 102 MakeABookmarkChange(0); | 102 MakeABookmarkChange(0); |
| 103 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 103 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 104 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 105 ASSERT_EQ(0U, GetAllKeys(0).size()); | 104 ASSERT_EQ(0U, GetAllKeys(0).size()); |
| 106 } | 105 } |
| 107 | 106 |
| 108 // TCM ID - 3678296. | 107 // TCM ID - 3678296. |
| 109 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { | 108 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { |
| 110 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 109 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 111 | 110 |
| 112 std::set<AutofillKey> keys; | 111 std::set<AutofillKey> keys; |
| 113 keys.insert(AutofillKey(base::WideToUTF16(L"Sigur R\u00F3s"), | 112 keys.insert(AutofillKey(base::WideToUTF16(L"Sigur R\u00F3s"), |
| 114 base::WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); | 113 base::WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
| 115 AddKeys(0, keys); | 114 AddKeys(0, keys); |
| 116 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 115 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 117 ASSERT_TRUE(AwaitQuiescence()); | 116 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 118 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 119 } | 117 } |
| 120 | 118 |
| 121 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 119 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 122 AddDuplicateNamesToSameProfile) { | 120 AddDuplicateNamesToSameProfile) { |
| 123 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 121 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 124 | 122 |
| 125 std::set<AutofillKey> keys; | 123 std::set<AutofillKey> keys; |
| 126 keys.insert(AutofillKey("name0", "value0-0")); | 124 keys.insert(AutofillKey("name0", "value0-0")); |
| 127 keys.insert(AutofillKey("name0", "value0-1")); | 125 keys.insert(AutofillKey("name0", "value0-1")); |
| 128 keys.insert(AutofillKey("name1", "value1")); | 126 keys.insert(AutofillKey("name1", "value1")); |
| 129 AddKeys(0, keys); | 127 AddKeys(0, keys); |
| 130 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 128 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 131 ASSERT_TRUE(AwaitQuiescence()); | 129 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 132 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 133 ASSERT_EQ(2U, GetAllKeys(0).size()); | 130 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 134 } | 131 } |
| 135 | 132 |
| 136 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 133 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 137 AddDuplicateNamesToDifferentProfiles) { | 134 AddDuplicateNamesToDifferentProfiles) { |
| 138 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 135 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 139 | 136 |
| 140 std::set<AutofillKey> keys0; | 137 std::set<AutofillKey> keys0; |
| 141 keys0.insert(AutofillKey("name0", "value0-0")); | 138 keys0.insert(AutofillKey("name0", "value0-0")); |
| 142 keys0.insert(AutofillKey("name1", "value1")); | 139 keys0.insert(AutofillKey("name1", "value1")); |
| 143 AddKeys(0, keys0); | 140 AddKeys(0, keys0); |
| 144 | 141 |
| 145 std::set<AutofillKey> keys1; | 142 std::set<AutofillKey> keys1; |
| 146 keys1.insert(AutofillKey("name0", "value0-1")); | 143 keys1.insert(AutofillKey("name0", "value0-1")); |
| 147 keys1.insert(AutofillKey("name2", "value2")); | 144 keys1.insert(AutofillKey("name2", "value2")); |
| 148 keys1.insert(AutofillKey("name3", "value3")); | 145 keys1.insert(AutofillKey("name3", "value3")); |
| 149 AddKeys(1, keys1); | 146 AddKeys(1, keys1); |
| 150 | 147 |
| 151 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 148 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 152 ASSERT_TRUE(AwaitQuiescence()); | 149 ASSERT_TRUE(AwaitKeysMatch(0, 1)); |
| 153 ASSERT_TRUE(KeysMatch(0, 1)); | |
| 154 ASSERT_EQ(5U, GetAllKeys(0).size()); | 150 ASSERT_EQ(5U, GetAllKeys(0).size()); |
| 155 } | 151 } |
| 156 | 152 |
| 157 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 153 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 158 PersonalDataManagerSanity) { | 154 PersonalDataManagerSanity) { |
| 159 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 155 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 160 | 156 |
| 161 // Client0 adds a profile. | 157 // Client0 adds a profile. |
| 162 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 158 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 163 MakeABookmarkChange(0); | 159 MakeABookmarkChange(0); |
| 164 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 160 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 165 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 166 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 161 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 167 | 162 |
| 168 // Client1 adds a profile. | 163 // Client1 adds a profile. |
| 169 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); | 164 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
| 170 MakeABookmarkChange(1); | 165 MakeABookmarkChange(1); |
| 171 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 166 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 172 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 173 ASSERT_EQ(2U, GetAllProfiles(0).size()); | 167 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 174 | 168 |
| 175 // Client0 adds the same profile. | 169 // Client0 adds the same profile. |
| 176 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); | 170 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
| 177 MakeABookmarkChange(0); | 171 MakeABookmarkChange(0); |
| 178 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 172 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 179 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 180 ASSERT_EQ(2U, GetAllProfiles(0).size()); | 173 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 181 | 174 |
| 182 // Client1 removes a profile. | 175 // Client1 removes a profile. |
| 183 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); | 176 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 184 MakeABookmarkChange(1); | 177 MakeABookmarkChange(1); |
| 185 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 178 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 186 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 187 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 179 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 188 | 180 |
| 189 // Client0 updates a profile. | 181 // Client0 updates a profile. |
| 190 UpdateProfile(0, | 182 UpdateProfile(0, |
| 191 GetAllProfiles(0)[0]->guid(), | 183 GetAllProfiles(0)[0]->guid(), |
| 192 AutofillType(autofill::NAME_FIRST), | 184 AutofillType(autofill::NAME_FIRST), |
| 193 base::ASCIIToUTF16("Bart")); | 185 base::ASCIIToUTF16("Bart")); |
| 194 MakeABookmarkChange(0); | 186 MakeABookmarkChange(0); |
| 195 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 187 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 196 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 197 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 188 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 198 | 189 |
| 199 // Client1 removes remaining profile. | 190 // Client1 removes remaining profile. |
| 200 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); | 191 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 201 MakeABookmarkChange(1); | 192 MakeABookmarkChange(1); |
| 202 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 193 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 203 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 204 ASSERT_EQ(0U, GetAllProfiles(0).size()); | 194 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 205 } | 195 } |
| 206 | 196 |
| 207 // TCM ID - 7261786. | 197 // TCM ID - 7261786. |
| 208 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { | 198 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { |
| 209 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 199 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 210 | 200 |
| 211 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 201 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 212 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 202 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 213 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 203 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 214 ASSERT_TRUE(AwaitQuiescence()); | 204 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 215 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 216 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 205 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 217 } | 206 } |
| 218 | 207 |
| 219 // TCM ID - 3636294. | 208 // TCM ID - 3636294. |
| 220 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { | 209 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { |
| 221 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 210 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 222 | 211 |
| 223 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); | 212 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); |
| 224 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); | 213 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); |
| 225 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, | 214 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, |
| 226 base::ASCIIToUTF16("1234567890")); | 215 base::ASCIIToUTF16("1234567890")); |
| 227 | 216 |
| 228 AddProfile(0, profile0); | 217 AddProfile(0, profile0); |
| 229 AddProfile(1, profile1); | 218 AddProfile(1, profile1); |
| 230 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 219 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 231 ASSERT_TRUE(AwaitQuiescence()); | 220 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 232 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 233 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 221 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 234 } | 222 } |
| 235 | 223 |
| 236 // TCM ID - 3626291. | 224 // TCM ID - 3626291. |
| 237 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { | 225 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { |
| 238 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 226 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 239 | 227 |
| 240 AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); | 228 AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); |
| 241 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 229 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 242 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 243 ASSERT_EQ(0U, GetAllProfiles(0).size()); | 230 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 244 } | 231 } |
| 245 | 232 |
| 246 // TCM ID - 3616283. | 233 // TCM ID - 3616283. |
| 247 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { | 234 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { |
| 248 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 235 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 249 | 236 |
| 250 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 237 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 251 MakeABookmarkChange(0); | 238 MakeABookmarkChange(0); |
| 252 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 239 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 253 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 254 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 240 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 255 } | 241 } |
| 256 | 242 |
| 257 // TCM ID - 3632260. | 243 // TCM ID - 3632260. |
| 258 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { | 244 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { |
| 259 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 245 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 260 | 246 |
| 261 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 247 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 262 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); | 248 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
| 263 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); | 249 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); |
| 264 MakeABookmarkChange(0); | 250 MakeABookmarkChange(0); |
| 265 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 251 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 266 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 267 ASSERT_EQ(3U, GetAllProfiles(0).size()); | 252 ASSERT_EQ(3U, GetAllProfiles(0).size()); |
| 268 } | 253 } |
| 269 | 254 |
| 270 // TCM ID - 3602257. | 255 // TCM ID - 3602257. |
| 271 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { | 256 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { |
| 272 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 257 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 273 | 258 |
| 274 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 259 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 275 MakeABookmarkChange(0); | 260 MakeABookmarkChange(0); |
| 276 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 261 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 277 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 278 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 262 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 279 | 263 |
| 280 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); | 264 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 281 MakeABookmarkChange(1); | 265 MakeABookmarkChange(1); |
| 282 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 266 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 283 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 284 ASSERT_EQ(0U, GetAllProfiles(0).size()); | 267 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 285 } | 268 } |
| 286 | 269 |
| 287 // TCM ID - 3627300. | 270 // TCM ID - 3627300. |
| 288 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { | 271 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { |
| 289 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 272 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 290 | 273 |
| 291 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 274 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 292 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); | 275 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
| 293 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); | 276 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); |
| 294 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 277 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 295 ASSERT_TRUE(AwaitQuiescence()); | 278 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 296 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 297 ASSERT_EQ(3U, GetAllProfiles(0).size()); | 279 ASSERT_EQ(3U, GetAllProfiles(0).size()); |
| 298 } | 280 } |
| 299 | 281 |
| 300 // TCM ID - 3665264. | 282 // TCM ID - 3665264. |
| 301 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { | 283 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { |
| 302 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 284 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 303 | 285 |
| 304 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 286 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 305 MakeABookmarkChange(0); | 287 MakeABookmarkChange(0); |
| 306 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 288 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 307 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 308 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 289 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 309 | 290 |
| 310 UpdateProfile(0, | 291 UpdateProfile(0, |
| 311 GetAllProfiles(0)[0]->guid(), | 292 GetAllProfiles(0)[0]->guid(), |
| 312 AutofillType(autofill::NAME_FIRST), | 293 AutofillType(autofill::NAME_FIRST), |
| 313 base::ASCIIToUTF16("Lisa")); | 294 base::ASCIIToUTF16("Lisa")); |
| 314 UpdateProfile(0, | 295 UpdateProfile(0, |
| 315 GetAllProfiles(0)[0]->guid(), | 296 GetAllProfiles(0)[0]->guid(), |
| 316 AutofillType(autofill::EMAIL_ADDRESS), | 297 AutofillType(autofill::EMAIL_ADDRESS), |
| 317 base::ASCIIToUTF16("grrrl@TV.com")); | 298 base::ASCIIToUTF16("grrrl@TV.com")); |
| 318 MakeABookmarkChange(0); | 299 MakeABookmarkChange(0); |
| 319 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 300 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 320 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 321 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 301 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 322 } | 302 } |
| 323 | 303 |
| 324 // TCM ID - 3628299. | 304 // TCM ID - 3628299. |
| 325 // This test is flaky on all platforms. See crbug.com/152551. | 305 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { |
| 326 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DISABLED_ConflictingFields) { | |
| 327 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 306 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 328 | 307 |
| 329 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 308 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 330 MakeABookmarkChange(0); | 309 MakeABookmarkChange(0); |
| 331 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 310 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 332 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 333 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 311 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 334 UpdateProfile(0, | 312 UpdateProfile(0, |
| 335 GetAllProfiles(0)[0]->guid(), | 313 GetAllProfiles(0)[0]->guid(), |
| 336 AutofillType(autofill::NAME_FIRST), | 314 AutofillType(autofill::NAME_FIRST), |
| 337 base::ASCIIToUTF16("Lisa")); | 315 base::ASCIIToUTF16("Lisa")); |
| 338 MakeABookmarkChange(0); | 316 MakeABookmarkChange(0); |
| 339 UpdateProfile(1, | 317 UpdateProfile(1, |
| 340 GetAllProfiles(1)[0]->guid(), | 318 GetAllProfiles(1)[0]->guid(), |
| 341 AutofillType(autofill::NAME_FIRST), | 319 AutofillType(autofill::NAME_FIRST), |
| 342 base::ASCIIToUTF16("Bart")); | 320 base::ASCIIToUTF16("Bart")); |
| 343 MakeABookmarkChange(1); | 321 MakeABookmarkChange(1); |
| 344 ASSERT_TRUE(AwaitQuiescence()); | 322 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 345 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 346 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 323 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 347 } | 324 } |
| 348 | 325 |
| 349 // TCM ID - 3663293. | |
| 350 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { | |
| 351 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 352 | |
| 353 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | |
| 354 MakeABookmarkChange(0); | |
| 355 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | |
| 356 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 357 ASSERT_EQ(1U, GetAllProfiles(0).size()); | |
| 358 | |
| 359 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncer::AUTOFILL)); | |
| 360 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); | |
| 361 MakeABookmarkChange(0); | |
| 362 ASSERT_TRUE(AwaitQuiescence()); | |
| 363 ASSERT_FALSE(ProfilesMatch(0, 1)); | |
| 364 ASSERT_EQ(2U, GetAllProfiles(0).size()); | |
| 365 ASSERT_EQ(1U, GetAllProfiles(1).size()); | |
| 366 | |
| 367 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncer::AUTOFILL)); | |
| 368 MakeABookmarkChange(0); | |
| 369 ASSERT_TRUE(AwaitQuiescence()); | |
| 370 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 371 ASSERT_EQ(2U, GetAllProfiles(0).size()); | |
| 372 } | |
| 373 | |
| 374 // TCM ID - 3661291. | |
| 375 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) { | |
| 376 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 377 | |
| 378 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | |
| 379 MakeABookmarkChange(0); | |
| 380 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | |
| 381 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 382 ASSERT_EQ(1U, GetAllProfiles(0).size()); | |
| 383 | |
| 384 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); | |
| 385 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); | |
| 386 MakeABookmarkChange(0); | |
| 387 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); | |
| 388 ASSERT_FALSE(ProfilesMatch(0, 1)); | |
| 389 ASSERT_EQ(2U, GetAllProfiles(0).size()); | |
| 390 ASSERT_EQ(1U, GetAllProfiles(1).size()); | |
| 391 | |
| 392 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); | |
| 393 ASSERT_TRUE(AwaitQuiescence()); | |
| 394 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 395 ASSERT_EQ(2U, GetAllProfiles(0).size()); | |
| 396 } | |
| 397 | |
| 398 // TCM ID - 3608295. | 326 // TCM ID - 3608295. |
| 399 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { | 327 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { |
| 400 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 328 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 401 | 329 |
| 402 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 330 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 403 MakeABookmarkChange(0); | 331 MakeABookmarkChange(0); |
| 404 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 332 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 405 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 406 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 333 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 407 | 334 |
| 408 base::string16 max_length_string(AutofillTable::kMaxDataLength, '.'); | 335 base::string16 max_length_string(AutofillTable::kMaxDataLength, '.'); |
| 409 UpdateProfile(0, | 336 UpdateProfile(0, |
| 410 GetAllProfiles(0)[0]->guid(), | 337 GetAllProfiles(0)[0]->guid(), |
| 411 AutofillType(autofill::NAME_FIRST), | 338 AutofillType(autofill::NAME_FIRST), |
| 412 max_length_string); | 339 max_length_string); |
| 413 UpdateProfile(0, | 340 UpdateProfile(0, |
| 414 GetAllProfiles(0)[0]->guid(), | 341 GetAllProfiles(0)[0]->guid(), |
| 415 AutofillType(autofill::NAME_LAST), | 342 AutofillType(autofill::NAME_LAST), |
| 416 max_length_string); | 343 max_length_string); |
| 417 UpdateProfile(0, | 344 UpdateProfile(0, |
| 418 GetAllProfiles(0)[0]->guid(), | 345 GetAllProfiles(0)[0]->guid(), |
| 419 AutofillType(autofill::EMAIL_ADDRESS), | 346 AutofillType(autofill::EMAIL_ADDRESS), |
| 420 max_length_string); | 347 max_length_string); |
| 421 UpdateProfile(0, | 348 UpdateProfile(0, |
| 422 GetAllProfiles(0)[0]->guid(), | 349 GetAllProfiles(0)[0]->guid(), |
| 423 AutofillType(autofill::ADDRESS_HOME_LINE1), | 350 AutofillType(autofill::ADDRESS_HOME_LINE1), |
| 424 max_length_string); | 351 max_length_string); |
| 425 | 352 |
| 426 MakeABookmarkChange(0); | 353 MakeABookmarkChange(0); |
| 427 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 354 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 428 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 429 } | 355 } |
| 430 | 356 |
| 431 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { | 357 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { |
| 432 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 358 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 433 | 359 |
| 434 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 360 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 435 MakeABookmarkChange(0); | 361 MakeABookmarkChange(0); |
| 436 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 362 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 437 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 438 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 363 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 439 | 364 |
| 440 base::string16 exceeds_max_length_string( | 365 base::string16 exceeds_max_length_string( |
| 441 AutofillTable::kMaxDataLength + 1, '.'); | 366 AutofillTable::kMaxDataLength + 1, '.'); |
| 442 UpdateProfile(0, | 367 UpdateProfile(0, |
| 443 GetAllProfiles(0)[0]->guid(), | 368 GetAllProfiles(0)[0]->guid(), |
| 444 AutofillType(autofill::NAME_FIRST), | 369 AutofillType(autofill::NAME_FIRST), |
| 445 exceeds_max_length_string); | 370 exceeds_max_length_string); |
| 446 UpdateProfile(0, | 371 UpdateProfile(0, |
| 447 GetAllProfiles(0)[0]->guid(), | 372 GetAllProfiles(0)[0]->guid(), |
| 448 AutofillType(autofill::NAME_LAST), | 373 AutofillType(autofill::NAME_LAST), |
| 449 exceeds_max_length_string); | 374 exceeds_max_length_string); |
| 450 UpdateProfile(0, | 375 UpdateProfile(0, |
| 451 GetAllProfiles(0)[0]->guid(), | 376 GetAllProfiles(0)[0]->guid(), |
| 452 AutofillType(autofill::EMAIL_ADDRESS), | 377 AutofillType(autofill::EMAIL_ADDRESS), |
| 453 exceeds_max_length_string); | 378 exceeds_max_length_string); |
| 454 UpdateProfile(0, | 379 UpdateProfile(0, |
| 455 GetAllProfiles(0)[0]->guid(), | 380 GetAllProfiles(0)[0]->guid(), |
| 456 AutofillType(autofill::ADDRESS_HOME_LINE1), | 381 AutofillType(autofill::ADDRESS_HOME_LINE1), |
| 457 exceeds_max_length_string); | 382 exceeds_max_length_string); |
| 458 | 383 |
| 459 MakeABookmarkChange(0); | 384 MakeABookmarkChange(0); |
| 460 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 385 ASSERT_TRUE(bookmarks_helper::AwaitAllModelsMatch()); |
| 461 ASSERT_FALSE(ProfilesMatch(0, 1)); | 386 EXPECT_FALSE(ProfilesMatch(0, 1)); |
| 462 } | 387 } |
| 463 | 388 |
| 464 // Test credit cards don't sync. | 389 // Test credit cards don't sync. |
| 465 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { | 390 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { |
| 466 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 391 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 467 | 392 |
| 468 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 393 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 469 | 394 |
| 470 CreditCard card; | 395 CreditCard card; |
| 471 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, | 396 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, |
| 472 base::ASCIIToUTF16("6011111111111117")); | 397 base::ASCIIToUTF16("6011111111111117")); |
| 473 std::vector<CreditCard> credit_cards; | 398 std::vector<CreditCard> credit_cards; |
| 474 credit_cards.push_back(card); | 399 credit_cards.push_back(card); |
| 475 SetCreditCards(0, &credit_cards); | 400 SetCreditCards(0, &credit_cards); |
| 476 | 401 |
| 477 MakeABookmarkChange(0); | 402 MakeABookmarkChange(0); |
| 478 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 403 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); |
| 479 ASSERT_TRUE(ProfilesMatch(0, 1)); | |
| 480 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 404 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 481 | 405 |
| 482 PersonalDataManager* pdm = GetPersonalDataManager(1); | 406 PersonalDataManager* pdm = GetPersonalDataManager(1); |
| 483 ASSERT_EQ(0U, pdm->GetCreditCards().size()); | 407 ASSERT_EQ(0U, pdm->GetCreditCards().size()); |
| 484 } | 408 } |
| OLD | NEW |