| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 7 #include "chrome/browser/webdata/autofill_entry.h" | 7 #include "chrome/browser/webdata/autofill_entry.h" |
| 8 #include "chrome/test/live_sync/autofill_helper.h" | 8 #include "chrome/test/live_sync/autofill_helper.h" |
| 9 #include "chrome/test/live_sync/live_sync_test.h" | 9 #include "chrome/test/live_sync/live_sync_test.h" |
| 10 | 10 |
| 11 using autofill_helper::AddKeys; |
| 12 using autofill_helper::AddProfile; |
| 13 using autofill_helper::CreateAutofillProfile; |
| 14 using autofill_helper::GetAllKeys; |
| 15 using autofill_helper::GetAllProfiles; |
| 16 using autofill_helper::KeysMatch; |
| 17 using autofill_helper::ProfilesMatch; |
| 18 using autofill_helper::PROFILE_FRASIER; |
| 19 using autofill_helper::PROFILE_HOMER; |
| 20 using autofill_helper::PROFILE_MARION; |
| 21 using autofill_helper::PROFILE_NULL; |
| 22 using autofill_helper::RemoveKey; |
| 23 using autofill_helper::RemoveProfile; |
| 24 using autofill_helper::UpdateProfile; |
| 25 |
| 11 // Autofill entry length is limited to 1024. See http://crbug.com/49332. | 26 // Autofill entry length is limited to 1024. See http://crbug.com/49332. |
| 12 const size_t kMaxDataLength = 1024; | 27 const size_t kMaxDataLength = 1024; |
| 13 | 28 |
| 14 class TwoClientAutofillSyncTest : public LiveSyncTest { | 29 class TwoClientAutofillSyncTest : public LiveSyncTest { |
| 15 public: | 30 public: |
| 16 TwoClientAutofillSyncTest() : LiveSyncTest(TWO_CLIENT) {} | 31 TwoClientAutofillSyncTest() : LiveSyncTest(TWO_CLIENT) {} |
| 17 virtual ~TwoClientAutofillSyncTest() {} | 32 virtual ~TwoClientAutofillSyncTest() {} |
| 18 | 33 |
| 19 private: | 34 private: |
| 20 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); | 35 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); |
| 21 }; | 36 }; |
| 22 | 37 |
| 23 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { | 38 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { |
| 24 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 39 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 25 | 40 |
| 26 // Client0 adds a key. | 41 // Client0 adds a key. |
| 27 std::set<AutofillKey> keys; | 42 std::set<AutofillKey> keys; |
| 28 keys.insert(AutofillKey("name0", "value0")); | 43 keys.insert(AutofillKey("name0", "value0")); |
| 29 AutofillHelper::AddKeys(0, keys); | 44 AddKeys(0, keys); |
| 30 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 45 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 31 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 46 ASSERT_TRUE(KeysMatch(0, 1)); |
| 32 ASSERT_EQ(1U, AutofillHelper::GetAllKeys(0).size()); | 47 ASSERT_EQ(1U, GetAllKeys(0).size()); |
| 33 | 48 |
| 34 // Client1 adds a key. | 49 // Client1 adds a key. |
| 35 keys.clear(); | 50 keys.clear(); |
| 36 keys.insert(AutofillKey("name1", "value1-0")); | 51 keys.insert(AutofillKey("name1", "value1-0")); |
| 37 AutofillHelper::AddKeys(1, keys); | 52 AddKeys(1, keys); |
| 38 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 53 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 39 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 54 ASSERT_TRUE(KeysMatch(0, 1)); |
| 40 ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size()); | 55 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 41 | 56 |
| 42 // Client0 adds a key with the same name. | 57 // Client0 adds a key with the same name. |
| 43 keys.clear(); | 58 keys.clear(); |
| 44 keys.insert(AutofillKey("name1", "value1-1")); | 59 keys.insert(AutofillKey("name1", "value1-1")); |
| 45 AutofillHelper::AddKeys(0, keys); | 60 AddKeys(0, keys); |
| 46 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 61 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 47 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 62 ASSERT_TRUE(KeysMatch(0, 1)); |
| 48 ASSERT_EQ(3U, AutofillHelper::GetAllKeys(0).size()); | 63 ASSERT_EQ(3U, GetAllKeys(0).size()); |
| 49 | 64 |
| 50 // Client1 removes a key. | 65 // Client1 removes a key. |
| 51 AutofillHelper::RemoveKey(1, AutofillKey("name1", "value1-0")); | 66 RemoveKey(1, AutofillKey("name1", "value1-0")); |
| 52 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 67 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 53 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 68 ASSERT_TRUE(KeysMatch(0, 1)); |
| 54 ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size()); | 69 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 55 | 70 |
| 56 // Client0 removes the rest. | 71 // Client0 removes the rest. |
| 57 AutofillHelper::RemoveKey(0, AutofillKey("name0", "value0")); | 72 RemoveKey(0, AutofillKey("name0", "value0")); |
| 58 AutofillHelper::RemoveKey(0, AutofillKey("name1", "value1-1")); | 73 RemoveKey(0, AutofillKey("name1", "value1-1")); |
| 59 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 74 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 60 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 75 ASSERT_TRUE(KeysMatch(0, 1)); |
| 61 ASSERT_EQ(0U, AutofillHelper::GetAllKeys(0).size()); | 76 ASSERT_EQ(0U, GetAllKeys(0).size()); |
| 62 } | 77 } |
| 63 | 78 |
| 64 // TCM ID - 3678296. | 79 // TCM ID - 3678296. |
| 65 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { | 80 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { |
| 66 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 81 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 67 | 82 |
| 68 std::set<AutofillKey> keys; | 83 std::set<AutofillKey> keys; |
| 69 keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), | 84 keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), |
| 70 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); | 85 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
| 71 AutofillHelper::AddKeys(0, keys); | 86 AddKeys(0, keys); |
| 72 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 87 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 73 ASSERT_TRUE(AwaitQuiescence()); | 88 ASSERT_TRUE(AwaitQuiescence()); |
| 74 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 89 ASSERT_TRUE(KeysMatch(0, 1)); |
| 75 } | 90 } |
| 76 | 91 |
| 77 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 92 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 78 AddDuplicateNamesToSameProfile) { | 93 AddDuplicateNamesToSameProfile) { |
| 79 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 94 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 80 | 95 |
| 81 std::set<AutofillKey> keys; | 96 std::set<AutofillKey> keys; |
| 82 keys.insert(AutofillKey("name0", "value0-0")); | 97 keys.insert(AutofillKey("name0", "value0-0")); |
| 83 keys.insert(AutofillKey("name0", "value0-1")); | 98 keys.insert(AutofillKey("name0", "value0-1")); |
| 84 keys.insert(AutofillKey("name1", "value1")); | 99 keys.insert(AutofillKey("name1", "value1")); |
| 85 AutofillHelper::AddKeys(0, keys); | 100 AddKeys(0, keys); |
| 86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 101 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 87 ASSERT_TRUE(AwaitQuiescence()); | 102 ASSERT_TRUE(AwaitQuiescence()); |
| 88 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 103 ASSERT_TRUE(KeysMatch(0, 1)); |
| 89 ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size()); | 104 ASSERT_EQ(2U, GetAllKeys(0).size()); |
| 90 } | 105 } |
| 91 | 106 |
| 92 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 107 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 93 AddDuplicateNamesToDifferentProfiles) { | 108 AddDuplicateNamesToDifferentProfiles) { |
| 94 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 109 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 95 | 110 |
| 96 std::set<AutofillKey> keys0; | 111 std::set<AutofillKey> keys0; |
| 97 keys0.insert(AutofillKey("name0", "value0-0")); | 112 keys0.insert(AutofillKey("name0", "value0-0")); |
| 98 keys0.insert(AutofillKey("name1", "value1")); | 113 keys0.insert(AutofillKey("name1", "value1")); |
| 99 AutofillHelper::AddKeys(0, keys0); | 114 AddKeys(0, keys0); |
| 100 | 115 |
| 101 std::set<AutofillKey> keys1; | 116 std::set<AutofillKey> keys1; |
| 102 keys1.insert(AutofillKey("name0", "value0-1")); | 117 keys1.insert(AutofillKey("name0", "value0-1")); |
| 103 keys1.insert(AutofillKey("name2", "value2")); | 118 keys1.insert(AutofillKey("name2", "value2")); |
| 104 keys1.insert(AutofillKey("name3", "value3")); | 119 keys1.insert(AutofillKey("name3", "value3")); |
| 105 AutofillHelper::AddKeys(1, keys1); | 120 AddKeys(1, keys1); |
| 106 | 121 |
| 107 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 122 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 108 ASSERT_TRUE(AwaitQuiescence()); | 123 ASSERT_TRUE(AwaitQuiescence()); |
| 109 ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1)); | 124 ASSERT_TRUE(KeysMatch(0, 1)); |
| 110 ASSERT_EQ(5U, AutofillHelper::GetAllKeys(0).size()); | 125 ASSERT_EQ(5U, GetAllKeys(0).size()); |
| 111 } | 126 } |
| 112 | 127 |
| 113 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 128 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 114 PersonalDataManagerSanity) { | 129 PersonalDataManagerSanity) { |
| 115 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 130 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 116 | 131 |
| 117 // Client0 adds a profile. | 132 // Client0 adds a profile. |
| 118 AutofillHelper::AddProfile( | 133 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 119 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 134 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 120 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 135 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 121 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 136 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 122 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 123 | 137 |
| 124 // Client1 adds a profile. | 138 // Client1 adds a profile. |
| 125 AutofillHelper::AddProfile( | 139 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
| 126 1, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION)); | 140 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 127 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 141 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 128 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 142 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 129 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | |
| 130 | 143 |
| 131 // Client0 adds the same profile. | 144 // Client0 adds the same profile. |
| 132 AutofillHelper::AddProfile( | 145 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
| 133 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION)); | 146 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 134 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 147 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 135 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 148 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 136 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | |
| 137 | 149 |
| 138 // Client1 removes a profile. | 150 // Client1 removes a profile. |
| 139 AutofillHelper::RemoveProfile( | 151 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 140 1, AutofillHelper::GetAllProfiles(1)[0]->guid()); | 152 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 141 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 153 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 142 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 154 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 143 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 144 | 155 |
| 145 // Client0 updates a profile. | 156 // Client0 updates a profile. |
| 146 AutofillHelper::UpdateProfile( | 157 UpdateProfile(0, |
| 147 0, | 158 GetAllProfiles(0)[0]->guid(), |
| 148 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 159 AutofillType(NAME_FIRST), |
| 149 AutofillType(NAME_FIRST), | 160 ASCIIToUTF16("Bart")); |
| 150 ASCIIToUTF16("Bart")); | 161 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 151 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 162 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 152 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 163 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 153 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 154 | 164 |
| 155 // Client1 removes remaining profile. | 165 // Client1 removes remaining profile. |
| 156 AutofillHelper::RemoveProfile( | 166 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 157 1, AutofillHelper::GetAllProfiles(1)[0]->guid()); | 167 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 158 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 168 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 159 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 169 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 160 ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size()); | |
| 161 } | 170 } |
| 162 | 171 |
| 163 // TCM ID - 7261786. | 172 // TCM ID - 7261786. |
| 164 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { | 173 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { |
| 165 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 174 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 166 | 175 |
| 167 AutofillHelper::AddProfile( | 176 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 168 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 177 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 169 AutofillHelper::AddProfile( | 178 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 170 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 179 ASSERT_TRUE(AwaitQuiescence()); |
| 171 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 180 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 172 ASSERT_TRUE(AwaitQuiescence()); | 181 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 173 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 174 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 175 } | 182 } |
| 176 | 183 |
| 177 // TCM ID - 3636294. | 184 // TCM ID - 3636294. |
| 178 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { | 185 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { |
| 179 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 186 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 180 | 187 |
| 181 AutofillProfile profile0 = | 188 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); |
| 182 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER); | 189 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); |
| 183 AutofillProfile profile1 = | |
| 184 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER); | |
| 185 profile1.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1234567890")); | 190 profile1.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1234567890")); |
| 186 | 191 |
| 187 AutofillHelper::AddProfile(0, profile0); | 192 AddProfile(0, profile0); |
| 188 AutofillHelper::AddProfile(1, profile1); | 193 AddProfile(1, profile1); |
| 189 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 194 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 190 ASSERT_TRUE(AwaitQuiescence()); | 195 ASSERT_TRUE(AwaitQuiescence()); |
| 191 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 196 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 192 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | 197 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 193 } | 198 } |
| 194 | 199 |
| 195 // TCM ID - 3626291. | 200 // TCM ID - 3626291. |
| 196 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { | 201 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { |
| 197 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 202 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 198 | 203 |
| 199 AutofillHelper::AddProfile( | 204 AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); |
| 200 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_NULL)); | 205 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 201 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 206 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 202 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 207 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 203 ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size()); | |
| 204 } | 208 } |
| 205 | 209 |
| 206 // TCM ID - 3616283. | 210 // TCM ID - 3616283. |
| 207 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { | 211 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { |
| 208 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 212 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 209 | 213 |
| 210 AutofillHelper::AddProfile( | 214 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 211 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 215 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 212 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 216 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 213 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 217 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 214 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 215 } | 218 } |
| 216 | 219 |
| 217 // TCM ID - 3632260. | 220 // TCM ID - 3632260. |
| 218 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { | 221 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { |
| 219 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 222 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 220 | 223 |
| 221 AutofillHelper::AddProfile( | 224 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 222 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 225 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); |
| 223 AutofillHelper::AddProfile( | 226 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); |
| 224 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION)); | 227 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 225 AutofillHelper::AddProfile( | 228 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 226 0, | 229 ASSERT_EQ(3U, GetAllProfiles(0).size()); |
| 227 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER)); | |
| 228 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | |
| 229 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 230 ASSERT_EQ(3U, AutofillHelper::GetAllProfiles(0).size()); | |
| 231 } | 230 } |
| 232 | 231 |
| 233 // TCM ID - 3602257. | 232 // TCM ID - 3602257. |
| 234 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { | 233 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { |
| 235 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 234 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 236 | 235 |
| 237 AutofillHelper::AddProfile( | 236 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 238 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 237 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 239 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 238 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 240 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 239 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 241 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | 240 |
| 242 | 241 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 243 AutofillHelper::RemoveProfile( | 242 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 244 1, AutofillHelper::GetAllProfiles(1)[0]->guid()); | 243 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 245 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 244 ASSERT_EQ(0U, GetAllProfiles(0).size()); |
| 246 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 247 ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size()); | |
| 248 } | 245 } |
| 249 | 246 |
| 250 // TCM ID - 3627300. | 247 // TCM ID - 3627300. |
| 251 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { | 248 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { |
| 252 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 249 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 253 | 250 |
| 254 AutofillHelper::AddProfile( | 251 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 255 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 252 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); |
| 256 AutofillHelper::AddProfile( | 253 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); |
| 257 1, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION)); | 254 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 258 AutofillHelper::AddProfile( | 255 ASSERT_TRUE(AwaitQuiescence()); |
| 259 1, | 256 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 260 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER)); | 257 ASSERT_EQ(3U, GetAllProfiles(0).size()); |
| 261 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | |
| 262 ASSERT_TRUE(AwaitQuiescence()); | |
| 263 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 264 ASSERT_EQ(3U, AutofillHelper::GetAllProfiles(0).size()); | |
| 265 } | 258 } |
| 266 | 259 |
| 267 // TCM ID - 3665264. | 260 // TCM ID - 3665264. |
| 268 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { | 261 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { |
| 269 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 262 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 270 | 263 |
| 271 AutofillHelper::AddProfile( | 264 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 272 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 265 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 273 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 266 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 274 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 267 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 275 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | 268 |
| 276 | 269 UpdateProfile(0, |
| 277 AutofillHelper::UpdateProfile( | 270 GetAllProfiles(0)[0]->guid(), |
| 278 0, | 271 AutofillType(NAME_FIRST), |
| 279 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 272 ASCIIToUTF16("Lisa")); |
| 280 AutofillType(NAME_FIRST), | 273 UpdateProfile(0, |
| 281 ASCIIToUTF16("Lisa")); | 274 GetAllProfiles(0)[0]->guid(), |
| 282 AutofillHelper::UpdateProfile( | 275 AutofillType(EMAIL_ADDRESS), |
| 283 0, | 276 ASCIIToUTF16("grrrl@TV.com")); |
| 284 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 277 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 285 AutofillType(EMAIL_ADDRESS), | 278 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 286 ASCIIToUTF16("grrrl@TV.com")); | 279 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 287 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | |
| 288 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 289 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 290 } | 280 } |
| 291 | 281 |
| 292 // TCM ID - 3628299. | 282 // TCM ID - 3628299. |
| 293 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { | 283 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { |
| 294 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 284 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 295 | 285 |
| 296 AutofillHelper::AddProfile( | 286 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 297 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 287 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 298 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 288 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 299 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 289 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 300 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | 290 UpdateProfile(0, |
| 301 AutofillHelper::UpdateProfile( | 291 GetAllProfiles(0)[0]->guid(), |
| 302 0, | 292 AutofillType(NAME_FIRST), |
| 303 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 293 ASCIIToUTF16("Lisa")); |
| 304 AutofillType(NAME_FIRST), | 294 UpdateProfile(1, |
| 305 ASCIIToUTF16("Lisa")); | 295 GetAllProfiles(1)[0]->guid(), |
| 306 AutofillHelper::UpdateProfile( | 296 AutofillType(NAME_FIRST), |
| 307 1, | 297 ASCIIToUTF16("Bart")); |
| 308 AutofillHelper::GetAllProfiles(1)[0]->guid(), | 298 ASSERT_TRUE(AwaitQuiescence()); |
| 309 AutofillType(NAME_FIRST), | 299 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 310 ASCIIToUTF16("Bart")); | 300 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 311 ASSERT_TRUE(AwaitQuiescence()); | |
| 312 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 313 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 314 } | 301 } |
| 315 | 302 |
| 316 // TCM ID - 3663293. | 303 // TCM ID - 3663293. |
| 317 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { | 304 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { |
| 318 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 305 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 319 | 306 |
| 320 AutofillHelper::AddProfile( | 307 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 321 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 308 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 322 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 309 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 323 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 310 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 324 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 325 | 311 |
| 326 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncable::AUTOFILL)); | 312 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncable::AUTOFILL)); |
| 327 AutofillHelper::AddProfile( | 313 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); |
| 328 0, | 314 ASSERT_TRUE(AwaitQuiescence()); |
| 329 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER)); | 315 ASSERT_FALSE(ProfilesMatch(0, 1)); |
| 330 ASSERT_TRUE(AwaitQuiescence()); | 316 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 331 ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1)); | 317 ASSERT_EQ(1U, GetAllProfiles(1).size()); |
| 332 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | |
| 333 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(1).size()); | |
| 334 | 318 |
| 335 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncable::AUTOFILL)); | 319 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncable::AUTOFILL)); |
| 336 ASSERT_TRUE(AwaitQuiescence()); | 320 ASSERT_TRUE(AwaitQuiescence()); |
| 337 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 321 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 338 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | 322 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 339 } | 323 } |
| 340 | 324 |
| 341 // TCM ID - 3661291. | 325 // TCM ID - 3661291. |
| 342 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) { | 326 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) { |
| 343 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 327 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 344 | 328 |
| 345 AutofillHelper::AddProfile( | 329 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 346 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 330 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 347 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 331 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 348 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 332 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 349 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 350 | 333 |
| 351 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); | 334 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); |
| 352 AutofillHelper::AddProfile( | 335 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); |
| 353 0, | |
| 354 AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER)); | |
| 355 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Added a profile.")); | 336 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Added a profile.")); |
| 356 ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1)); | 337 ASSERT_FALSE(ProfilesMatch(0, 1)); |
| 357 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | 338 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 358 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(1).size()); | 339 ASSERT_EQ(1U, GetAllProfiles(1).size()); |
| 359 | 340 |
| 360 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); | 341 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); |
| 361 ASSERT_TRUE(AwaitQuiescence()); | 342 ASSERT_TRUE(AwaitQuiescence()); |
| 362 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 343 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 363 ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size()); | 344 ASSERT_EQ(2U, GetAllProfiles(0).size()); |
| 364 } | 345 } |
| 365 | 346 |
| 366 // TCM ID - 3608295. | 347 // TCM ID - 3608295. |
| 367 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { | 348 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { |
| 368 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 349 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 369 | 350 |
| 370 AutofillHelper::AddProfile( | 351 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 371 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | 352 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 372 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 353 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 373 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 354 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 374 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | |
| 375 | 355 |
| 376 string16 max_length_string(kMaxDataLength, '.'); | 356 string16 max_length_string(kMaxDataLength, '.'); |
| 377 AutofillHelper::UpdateProfile( | 357 UpdateProfile(0, |
| 378 0, | 358 GetAllProfiles(0)[0]->guid(), |
| 379 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 359 AutofillType(NAME_FIRST), |
| 380 AutofillType(NAME_FIRST), | 360 max_length_string); |
| 381 max_length_string); | 361 UpdateProfile(0, |
| 382 AutofillHelper::UpdateProfile( | 362 GetAllProfiles(0)[0]->guid(), |
| 383 0, | 363 AutofillType(NAME_LAST), |
| 384 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 364 max_length_string); |
| 385 AutofillType(NAME_LAST), | 365 UpdateProfile(0, |
| 386 max_length_string); | 366 GetAllProfiles(0)[0]->guid(), |
| 387 AutofillHelper::UpdateProfile( | 367 AutofillType(EMAIL_ADDRESS), |
| 388 0, | 368 max_length_string); |
| 389 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 369 UpdateProfile(0, |
| 390 AutofillType(EMAIL_ADDRESS), | 370 GetAllProfiles(0)[0]->guid(), |
| 391 max_length_string); | 371 AutofillType(ADDRESS_HOME_LINE1), |
| 392 AutofillHelper::UpdateProfile( | 372 max_length_string); |
| 393 0, | 373 |
| 394 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 374 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 395 AutofillType(ADDRESS_HOME_LINE1), | 375 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 396 max_length_string); | |
| 397 | |
| 398 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | |
| 399 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | |
| 400 } | 376 } |
| 401 | 377 |
| 402 // TODO(braffert): Remove FAILS annotation when crbug.com/85769 is resolved. | 378 // TODO(braffert): Remove FAILS annotation when crbug.com/85769 is resolved. |
| 403 // TCM ID - 7735472. | 379 // TCM ID - 7735472. |
| 404 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FAILS_ExceedsMaxLength) { | 380 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FAILS_ExceedsMaxLength) { |
| 405 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 381 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 406 | 382 |
| 407 AutofillHelper::AddProfile( | 383 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 408 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER)); | |
| 409 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 384 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 410 ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1)); | 385 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 411 ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size()); | 386 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 412 | 387 |
| 413 string16 exceeds_max_length_string(kMaxDataLength + 1, '.'); | 388 string16 exceeds_max_length_string(kMaxDataLength + 1, '.'); |
| 414 AutofillHelper::UpdateProfile( | 389 UpdateProfile(0, |
| 415 0, | 390 GetAllProfiles(0)[0]->guid(), |
| 416 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 391 AutofillType(NAME_FIRST), |
| 417 AutofillType(NAME_FIRST), | 392 exceeds_max_length_string); |
| 418 exceeds_max_length_string); | 393 UpdateProfile(0, |
| 419 AutofillHelper::UpdateProfile( | 394 GetAllProfiles(0)[0]->guid(), |
| 420 0, | 395 AutofillType(NAME_LAST), |
| 421 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 396 exceeds_max_length_string); |
| 422 AutofillType(NAME_LAST), | 397 UpdateProfile(0, |
| 423 exceeds_max_length_string); | 398 GetAllProfiles(0)[0]->guid(), |
| 424 AutofillHelper::UpdateProfile( | 399 AutofillType(EMAIL_ADDRESS), |
| 425 0, | 400 exceeds_max_length_string); |
| 426 AutofillHelper::GetAllProfiles(0)[0]->guid(), | 401 UpdateProfile(0, |
| 427 AutofillType(EMAIL_ADDRESS), | 402 GetAllProfiles(0)[0]->guid(), |
| 428 exceeds_max_length_string); | 403 AutofillType(ADDRESS_HOME_LINE1), |
| 429 AutofillHelper::UpdateProfile( | 404 exceeds_max_length_string); |
| 430 0, | |
| 431 AutofillHelper::GetAllProfiles(0)[0]->guid(), | |
| 432 AutofillType(ADDRESS_HOME_LINE1), | |
| 433 exceeds_max_length_string); | |
| 434 | 405 |
| 435 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 406 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 436 ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1)); | 407 ASSERT_FALSE(ProfilesMatch(0, 1)); |
| 437 } | 408 } |
| OLD | NEW |