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