| 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/location.h" | 5 #include "base/location.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" | 8 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
| 9 #include "components/autofill/core/browser/autofill_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
| 10 #include "components/autofill/core/browser/webdata/autofill_change.h" | 10 #include "components/autofill/core/browser/webdata/autofill_change.h" |
| 11 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
| 12 #include "sync/api/sync_error_factory.h" | 12 #include "sync/api/sync_error_factory.h" |
| 13 #include "sync/api/sync_error_factory_mock.h" | 13 #include "sync/api/sync_error_factory_mock.h" |
| 14 #include "sync/protocol/sync.pb.h" | 14 #include "sync/protocol/sync.pb.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace autofill { | 18 namespace autofill { |
| 19 | 19 |
| 20 using ::testing::_; | 20 using ::testing::_; |
| 21 using ::testing::DoAll; | 21 using ::testing::DoAll; |
| 22 using ::testing::Eq; | 22 using ::testing::Eq; |
| 23 using ::testing::Return; | 23 using ::testing::Return; |
| 24 using ::testing::Property; | 24 using ::testing::Property; |
| 25 using base::ASCIIToUTF16; | 25 using base::ASCIIToUTF16; |
| 26 using base::UTF8ToUTF16; | |
| 27 using content::BrowserThread; | 26 using content::BrowserThread; |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 // Some guids for testing. | 30 // Some guids for testing. |
| 32 const char kGuid1[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; | 31 const char kGuid1[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44B"; |
| 33 const char kGuid2[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44C"; | 32 const char kGuid2[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44C"; |
| 34 const char kGuid3[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44D"; | 33 const char kGuid3[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44D"; |
| 35 const char kGuid4[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44E"; | 34 const char kGuid4[] = "EDC609ED-7EEE-4F27-B00C-423242A9C44E"; |
| 36 const char kHttpOrigin[] = "http://www.example.com/"; | 35 const char kHttpOrigin[] = "http://www.example.com/"; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 std::string guid_present2 = kGuid2; | 267 std::string guid_present2 = kGuid2; |
| 269 std::string guid_synced1 = kGuid3; | 268 std::string guid_synced1 = kGuid3; |
| 270 std::string guid_synced2 = kGuid4; | 269 std::string guid_synced2 = kGuid4; |
| 271 std::string origin_present1 = kHttpOrigin; | 270 std::string origin_present1 = kHttpOrigin; |
| 272 std::string origin_present2 = std::string(); | 271 std::string origin_present2 = std::string(); |
| 273 std::string origin_synced1 = kHttpsOrigin; | 272 std::string origin_synced1 = kHttpsOrigin; |
| 274 std::string origin_synced2 = kSettingsOrigin; | 273 std::string origin_synced2 = kSettingsOrigin; |
| 275 | 274 |
| 276 profiles_from_web_db.push_back( | 275 profiles_from_web_db.push_back( |
| 277 new AutofillProfile(guid_present1, origin_present1)); | 276 new AutofillProfile(guid_present1, origin_present1)); |
| 278 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 277 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 279 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 278 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 280 UTF8ToUTF16("1 1st st")); | 279 ASCIIToUTF16("1 1st st")); |
| 281 profiles_from_web_db.push_back( | 280 profiles_from_web_db.push_back( |
| 282 new AutofillProfile(guid_present2, origin_present2)); | 281 new AutofillProfile(guid_present2, origin_present2)); |
| 283 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom")); | 282 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom")); |
| 284 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 283 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 285 UTF8ToUTF16("2 2nd st")); | 284 ASCIIToUTF16("2 2nd st")); |
| 286 | 285 |
| 287 syncer::SyncDataList data_list; | 286 syncer::SyncDataList data_list; |
| 288 AutofillProfile profile1(guid_synced1, origin_synced1); | 287 AutofillProfile profile1(guid_synced1, origin_synced1); |
| 289 profile1.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Jane")); | 288 profile1.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Jane")); |
| 290 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); | 289 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); |
| 291 AutofillProfile profile2(guid_synced2, origin_synced2); | 290 AutofillProfile profile2(guid_synced2, origin_synced2); |
| 292 profile2.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Harry")); | 291 profile2.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Harry")); |
| 293 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); | 292 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); |
| 294 // This one will have the name and origin updated. | 293 // This one will have the name and origin updated. |
| 295 AutofillProfile profile3(guid_present2, origin_synced2); | 294 AutofillProfile profile3(guid_present2, origin_synced2); |
| 296 profile3.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom Doe")); | 295 profile3.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom Doe")); |
| 297 data_list.push_back(autofill_syncable_service_.CreateData(profile3)); | 296 data_list.push_back(autofill_syncable_service_.CreateData(profile3)); |
| 298 | 297 |
| 299 syncer::SyncChangeList expected_change_list; | 298 syncer::SyncChangeList expected_change_list; |
| 300 expected_change_list.push_back( | 299 expected_change_list.push_back( |
| 301 syncer::SyncChange(FROM_HERE, | 300 syncer::SyncChange(FROM_HERE, |
| 302 syncer::SyncChange::ACTION_ADD, | 301 syncer::SyncChange::ACTION_ADD, |
| 303 MockAutofillProfileSyncableService::CreateData( | 302 MockAutofillProfileSyncableService::CreateData( |
| 304 *profiles_from_web_db.front()))); | 303 *profiles_from_web_db.front()))); |
| 305 | 304 |
| 306 MockAutofillProfileSyncableService::DataBundle expected_bundle; | 305 MockAutofillProfileSyncableService::DataBundle expected_bundle; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 319 std::string guid_present2 = kGuid2; | 318 std::string guid_present2 = kGuid2; |
| 320 std::string guid_synced1 = kGuid3; | 319 std::string guid_synced1 = kGuid3; |
| 321 std::string guid_synced2 = kGuid4; | 320 std::string guid_synced2 = kGuid4; |
| 322 std::string origin_present1 = kHttpOrigin; | 321 std::string origin_present1 = kHttpOrigin; |
| 323 std::string origin_present2 = kSettingsOrigin; | 322 std::string origin_present2 = kSettingsOrigin; |
| 324 std::string origin_synced1 = kHttpsOrigin; | 323 std::string origin_synced1 = kHttpsOrigin; |
| 325 std::string origin_synced2 = kHttpsOrigin; | 324 std::string origin_synced2 = kHttpsOrigin; |
| 326 | 325 |
| 327 profiles_from_web_db.push_back( | 326 profiles_from_web_db.push_back( |
| 328 new AutofillProfile(guid_present1, origin_present1)); | 327 new AutofillProfile(guid_present1, origin_present1)); |
| 329 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 328 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 330 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 329 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 331 UTF8ToUTF16("1 1st st")); | 330 ASCIIToUTF16("1 1st st")); |
| 332 profiles_from_web_db.push_back( | 331 profiles_from_web_db.push_back( |
| 333 new AutofillProfile(guid_present2, origin_present2)); | 332 new AutofillProfile(guid_present2, origin_present2)); |
| 334 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom")); | 333 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom")); |
| 335 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 334 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 336 UTF8ToUTF16("2 2nd st")); | 335 ASCIIToUTF16("2 2nd st")); |
| 337 | 336 |
| 338 // The synced profiles are identical to the local ones, except that the guids | 337 // The synced profiles are identical to the local ones, except that the guids |
| 339 // are different. | 338 // are different. |
| 340 syncer::SyncDataList data_list; | 339 syncer::SyncDataList data_list; |
| 341 AutofillProfile profile1(guid_synced1, origin_synced1); | 340 AutofillProfile profile1(guid_synced1, origin_synced1); |
| 342 profile1.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 341 profile1.SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 343 profile1.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("1 1st st")); | 342 profile1.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1 1st st")); |
| 344 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); | 343 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); |
| 345 AutofillProfile profile2(guid_synced2, origin_synced2); | 344 AutofillProfile profile2(guid_synced2, origin_synced2); |
| 346 profile2.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom")); | 345 profile2.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom")); |
| 347 profile2.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("2 2nd st")); | 346 profile2.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("2 2nd st")); |
| 348 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); | 347 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); |
| 349 | 348 |
| 350 AutofillProfile expected_profile(profile2); | 349 AutofillProfile expected_profile(profile2); |
| 351 expected_profile.set_origin(kSettingsOrigin); | 350 expected_profile.set_origin(kSettingsOrigin); |
| 352 syncer::SyncChangeList expected_change_list; | 351 syncer::SyncChangeList expected_change_list; |
| 353 expected_change_list.push_back( | 352 expected_change_list.push_back( |
| 354 syncer::SyncChange(FROM_HERE, | 353 syncer::SyncChange(FROM_HERE, |
| 355 syncer::SyncChange::ACTION_UPDATE, | 354 syncer::SyncChange::ACTION_UPDATE, |
| 356 MockAutofillProfileSyncableService::CreateData( | 355 MockAutofillProfileSyncableService::CreateData( |
| 357 expected_profile))); | 356 expected_profile))); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 373 std::string guid_present2 = kGuid2; | 372 std::string guid_present2 = kGuid2; |
| 374 std::string guid_synced1 = kGuid3; | 373 std::string guid_synced1 = kGuid3; |
| 375 std::string guid_synced2 = kGuid4; | 374 std::string guid_synced2 = kGuid4; |
| 376 std::string origin_present1 = kHttpOrigin; | 375 std::string origin_present1 = kHttpOrigin; |
| 377 std::string origin_present2 = kSettingsOrigin; | 376 std::string origin_present2 = kSettingsOrigin; |
| 378 std::string origin_synced1 = kHttpsOrigin; | 377 std::string origin_synced1 = kHttpsOrigin; |
| 379 std::string origin_synced2 = kHttpsOrigin; | 378 std::string origin_synced2 = kHttpsOrigin; |
| 380 | 379 |
| 381 profiles_from_web_db.push_back( | 380 profiles_from_web_db.push_back( |
| 382 new AutofillProfile(guid_present1, origin_present1)); | 381 new AutofillProfile(guid_present1, origin_present1)); |
| 383 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 382 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 384 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 383 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 385 UTF8ToUTF16("1 1st st")); | 384 ASCIIToUTF16("1 1st st")); |
| 386 profiles_from_web_db.push_back( | 385 profiles_from_web_db.push_back( |
| 387 new AutofillProfile(guid_present2, origin_present2)); | 386 new AutofillProfile(guid_present2, origin_present2)); |
| 388 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom")); | 387 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom")); |
| 389 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, | 388 profiles_from_web_db.back()->SetRawInfo(ADDRESS_HOME_LINE1, |
| 390 UTF8ToUTF16("2 2nd st")); | 389 ASCIIToUTF16("2 2nd st")); |
| 391 | 390 |
| 392 // The synced profiles are identical to the local ones, except that the guids | 391 // The synced profiles are identical to the local ones, except that the guids |
| 393 // are different. | 392 // are different. |
| 394 syncer::SyncDataList data_list; | 393 syncer::SyncDataList data_list; |
| 395 AutofillProfile profile1(guid_synced1, origin_synced1); | 394 AutofillProfile profile1(guid_synced1, origin_synced1); |
| 396 profile1.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 395 profile1.SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 397 profile1.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("1 1st st")); | 396 profile1.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1 1st st")); |
| 398 profile1.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("Frobbers, Inc.")); | 397 profile1.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Frobbers, Inc.")); |
| 399 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); | 398 data_list.push_back(autofill_syncable_service_.CreateData(profile1)); |
| 400 AutofillProfile profile2(guid_synced2, origin_synced2); | 399 AutofillProfile profile2(guid_synced2, origin_synced2); |
| 401 profile2.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Tom")); | 400 profile2.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Tom")); |
| 402 profile2.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("2 2nd st")); | 401 profile2.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("2 2nd st")); |
| 403 profile2.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("Fizzbang, LLC.")); | 402 profile2.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Fizzbang, LLC.")); |
| 404 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); | 403 data_list.push_back(autofill_syncable_service_.CreateData(profile2)); |
| 405 | 404 |
| 406 // The first profile should have its origin updated. | 405 // The first profile should have its origin updated. |
| 407 // The second profile should remain as-is, because an unverified profile | 406 // The second profile should remain as-is, because an unverified profile |
| 408 // should never overwrite a verified one. | 407 // should never overwrite a verified one. |
| 409 AutofillProfile expected_profile(profile1); | 408 AutofillProfile expected_profile(profile1); |
| 410 expected_profile.set_origin(origin_present1); | 409 expected_profile.set_origin(origin_present1); |
| 411 syncer::SyncChangeList expected_change_list; | 410 syncer::SyncChangeList expected_change_list; |
| 412 expected_change_list.push_back( | 411 expected_change_list.push_back( |
| 413 syncer::SyncChange(FROM_HERE, | 412 syncer::SyncChange(FROM_HERE, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 431 } | 430 } |
| 432 | 431 |
| 433 // Ensure that no Sync events are generated to fill in missing origins from Sync | 432 // Ensure that no Sync events are generated to fill in missing origins from Sync |
| 434 // with explicitly present empty ones. This ensures that the migration to add | 433 // with explicitly present empty ones. This ensures that the migration to add |
| 435 // origins to profiles does not generate lots of needless Sync updates. | 434 // origins to profiles does not generate lots of needless Sync updates. |
| 436 TEST_F(AutofillProfileSyncableServiceTest, MergeDataEmptyOrigins) { | 435 TEST_F(AutofillProfileSyncableServiceTest, MergeDataEmptyOrigins) { |
| 437 std::vector<AutofillProfile*> profiles_from_web_db; | 436 std::vector<AutofillProfile*> profiles_from_web_db; |
| 438 | 437 |
| 439 // Create a profile with an empty origin. | 438 // Create a profile with an empty origin. |
| 440 AutofillProfile profile(kGuid1, std::string()); | 439 AutofillProfile profile(kGuid1, std::string()); |
| 441 profile.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 440 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 442 profile.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("1 1st st")); | 441 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1 1st st")); |
| 443 | 442 |
| 444 profiles_from_web_db.push_back(new AutofillProfile(profile)); | 443 profiles_from_web_db.push_back(new AutofillProfile(profile)); |
| 445 | 444 |
| 446 // Create a Sync profile identical to |profile|, except with no origin set. | 445 // Create a Sync profile identical to |profile|, except with no origin set. |
| 447 sync_pb::EntitySpecifics specifics; | 446 sync_pb::EntitySpecifics specifics; |
| 448 sync_pb::AutofillProfileSpecifics* autofill_specifics = | 447 sync_pb::AutofillProfileSpecifics* autofill_specifics = |
| 449 specifics.mutable_autofill_profile(); | 448 specifics.mutable_autofill_profile(); |
| 450 autofill_specifics->set_guid(profile.guid()); | 449 autofill_specifics->set_guid(profile.guid()); |
| 451 autofill_specifics->add_name_first("John"); | 450 autofill_specifics->add_name_first("John"); |
| 452 autofill_specifics->add_name_middle(std::string()); | 451 autofill_specifics->add_name_middle(std::string()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 468 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); | 467 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); |
| 469 } | 468 } |
| 470 | 469 |
| 471 TEST_F(AutofillProfileSyncableServiceTest, GetAllSyncData) { | 470 TEST_F(AutofillProfileSyncableServiceTest, GetAllSyncData) { |
| 472 std::vector<AutofillProfile*> profiles_from_web_db; | 471 std::vector<AutofillProfile*> profiles_from_web_db; |
| 473 std::string guid_present1 = kGuid1; | 472 std::string guid_present1 = kGuid1; |
| 474 std::string guid_present2 = kGuid2; | 473 std::string guid_present2 = kGuid2; |
| 475 | 474 |
| 476 profiles_from_web_db.push_back( | 475 profiles_from_web_db.push_back( |
| 477 new AutofillProfile(guid_present1, kHttpOrigin)); | 476 new AutofillProfile(guid_present1, kHttpOrigin)); |
| 478 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); | 477 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("John")); |
| 479 profiles_from_web_db.push_back( | 478 profiles_from_web_db.push_back( |
| 480 new AutofillProfile(guid_present2, kHttpsOrigin)); | 479 new AutofillProfile(guid_present2, kHttpsOrigin)); |
| 481 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, UTF8ToUTF16("Jane")); | 480 profiles_from_web_db.back()->SetRawInfo(NAME_FIRST, ASCIIToUTF16("Jane")); |
| 482 | 481 |
| 483 syncer::SyncChangeList expected_change_list; | 482 syncer::SyncChangeList expected_change_list; |
| 484 expected_change_list.push_back( | 483 expected_change_list.push_back( |
| 485 syncer::SyncChange(FROM_HERE, | 484 syncer::SyncChange(FROM_HERE, |
| 486 syncer::SyncChange::ACTION_ADD, | 485 syncer::SyncChange::ACTION_ADD, |
| 487 MockAutofillProfileSyncableService::CreateData( | 486 MockAutofillProfileSyncableService::CreateData( |
| 488 *profiles_from_web_db.front()))); | 487 *profiles_from_web_db.front()))); |
| 489 expected_change_list.push_back( | 488 expected_change_list.push_back( |
| 490 syncer::SyncChange(FROM_HERE, | 489 syncer::SyncChange(FROM_HERE, |
| 491 syncer::SyncChange::ACTION_ADD, | 490 syncer::SyncChange::ACTION_ADD, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 509 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); | 508 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); |
| 510 } | 509 } |
| 511 | 510 |
| 512 TEST_F(AutofillProfileSyncableServiceTest, ProcessSyncChanges) { | 511 TEST_F(AutofillProfileSyncableServiceTest, ProcessSyncChanges) { |
| 513 std::vector<AutofillProfile *> profiles_from_web_db; | 512 std::vector<AutofillProfile *> profiles_from_web_db; |
| 514 std::string guid_present = kGuid1; | 513 std::string guid_present = kGuid1; |
| 515 std::string guid_synced = kGuid2; | 514 std::string guid_synced = kGuid2; |
| 516 | 515 |
| 517 syncer::SyncChangeList change_list; | 516 syncer::SyncChangeList change_list; |
| 518 AutofillProfile profile(guid_synced, kHttpOrigin); | 517 AutofillProfile profile(guid_synced, kHttpOrigin); |
| 519 profile.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Jane")); | 518 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Jane")); |
| 520 change_list.push_back( | 519 change_list.push_back( |
| 521 syncer::SyncChange( | 520 syncer::SyncChange( |
| 522 FROM_HERE, | 521 FROM_HERE, |
| 523 syncer::SyncChange::ACTION_ADD, | 522 syncer::SyncChange::ACTION_ADD, |
| 524 MockAutofillProfileSyncableService::CreateData(profile))); | 523 MockAutofillProfileSyncableService::CreateData(profile))); |
| 525 AutofillProfile empty_profile(guid_present, kHttpsOrigin); | 524 AutofillProfile empty_profile(guid_present, kHttpsOrigin); |
| 526 change_list.push_back( | 525 change_list.push_back( |
| 527 syncer::SyncChange( | 526 syncer::SyncChange( |
| 528 FROM_HERE, | 527 FROM_HERE, |
| 529 syncer::SyncChange::ACTION_DELETE, | 528 syncer::SyncChange::ACTION_DELETE, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 545 EXPECT_FALSE(error.IsSet()); | 544 EXPECT_FALSE(error.IsSet()); |
| 546 } | 545 } |
| 547 | 546 |
| 548 TEST_F(AutofillProfileSyncableServiceTest, AutofillProfileAdded) { | 547 TEST_F(AutofillProfileSyncableServiceTest, AutofillProfileAdded) { |
| 549 // Will be owned by the syncable service. Keep a reference available here for | 548 // Will be owned by the syncable service. Keep a reference available here for |
| 550 // verifying test expectations. | 549 // verifying test expectations. |
| 551 TestSyncChangeProcessor* sync_change_processor = new TestSyncChangeProcessor; | 550 TestSyncChangeProcessor* sync_change_processor = new TestSyncChangeProcessor; |
| 552 autofill_syncable_service_.set_sync_processor(sync_change_processor); | 551 autofill_syncable_service_.set_sync_processor(sync_change_processor); |
| 553 | 552 |
| 554 AutofillProfile profile(kGuid1, kHttpsOrigin); | 553 AutofillProfile profile(kGuid1, kHttpsOrigin); |
| 555 profile.SetRawInfo(NAME_FIRST, UTF8ToUTF16("Jane")); | 554 profile.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Jane")); |
| 556 AutofillProfileChange change(AutofillProfileChange::ADD, kGuid1, &profile); | 555 AutofillProfileChange change(AutofillProfileChange::ADD, kGuid1, &profile); |
| 557 autofill_syncable_service_.AutofillProfileChanged(change); | 556 autofill_syncable_service_.AutofillProfileChanged(change); |
| 558 | 557 |
| 559 ASSERT_EQ(1U, sync_change_processor->changes().size()); | 558 ASSERT_EQ(1U, sync_change_processor->changes().size()); |
| 560 syncer::SyncChange result = sync_change_processor->changes()[0]; | 559 syncer::SyncChange result = sync_change_processor->changes()[0]; |
| 561 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, result.change_type()); | 560 EXPECT_EQ(syncer::SyncChange::ACTION_ADD, result.change_type()); |
| 562 | 561 |
| 563 sync_pb::AutofillProfileSpecifics specifics = | 562 sync_pb::AutofillProfileSpecifics specifics = |
| 564 result.sync_data().GetSpecifics().autofill_profile(); | 563 result.sync_data().GetSpecifics().autofill_profile(); |
| 565 EXPECT_EQ(kGuid1, specifics.guid()); | 564 EXPECT_EQ(kGuid1, specifics.guid()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 581 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, result.change_type()); | 580 EXPECT_EQ(syncer::SyncChange::ACTION_DELETE, result.change_type()); |
| 582 sync_pb::AutofillProfileSpecifics specifics = | 581 sync_pb::AutofillProfileSpecifics specifics = |
| 583 result.sync_data().GetSpecifics().autofill_profile(); | 582 result.sync_data().GetSpecifics().autofill_profile(); |
| 584 EXPECT_EQ(kGuid2, specifics.guid()); | 583 EXPECT_EQ(kGuid2, specifics.guid()); |
| 585 } | 584 } |
| 586 | 585 |
| 587 TEST_F(AutofillProfileSyncableServiceTest, UpdateField) { | 586 TEST_F(AutofillProfileSyncableServiceTest, UpdateField) { |
| 588 AutofillProfile profile(kGuid1, kSettingsOrigin); | 587 AutofillProfile profile(kGuid1, kSettingsOrigin); |
| 589 std::string company1 = "A Company"; | 588 std::string company1 = "A Company"; |
| 590 std::string company2 = "Another Company"; | 589 std::string company2 = "Another Company"; |
| 591 profile.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(company1)); | 590 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16(company1)); |
| 592 EXPECT_FALSE(AutofillProfileSyncableService::UpdateField( | 591 EXPECT_FALSE(AutofillProfileSyncableService::UpdateField( |
| 593 COMPANY_NAME, company1, &profile)); | 592 COMPANY_NAME, company1, &profile)); |
| 594 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), UTF8ToUTF16(company1)); | 593 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), ASCIIToUTF16(company1)); |
| 595 EXPECT_TRUE(AutofillProfileSyncableService::UpdateField( | 594 EXPECT_TRUE(AutofillProfileSyncableService::UpdateField( |
| 596 COMPANY_NAME, company2, &profile)); | 595 COMPANY_NAME, company2, &profile)); |
| 597 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), UTF8ToUTF16(company2)); | 596 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), ASCIIToUTF16(company2)); |
| 598 EXPECT_FALSE(AutofillProfileSyncableService::UpdateField( | 597 EXPECT_FALSE(AutofillProfileSyncableService::UpdateField( |
| 599 COMPANY_NAME, company2, &profile)); | 598 COMPANY_NAME, company2, &profile)); |
| 600 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), UTF8ToUTF16(company2)); | 599 EXPECT_EQ(profile.GetRawInfo(COMPANY_NAME), ASCIIToUTF16(company2)); |
| 601 } | 600 } |
| 602 | 601 |
| 603 TEST_F(AutofillProfileSyncableServiceTest, UpdateMultivaluedField) { | 602 TEST_F(AutofillProfileSyncableServiceTest, UpdateMultivaluedField) { |
| 604 AutofillProfile profile(kGuid1, kHttpsOrigin); | 603 AutofillProfile profile(kGuid1, kHttpsOrigin); |
| 605 | 604 |
| 606 std::vector<base::string16> values; | 605 std::vector<base::string16> values; |
| 607 values.push_back(UTF8ToUTF16("1@1.com")); | 606 values.push_back(ASCIIToUTF16("1@1.com")); |
| 608 values.push_back(UTF8ToUTF16("2@1.com")); | 607 values.push_back(ASCIIToUTF16("2@1.com")); |
| 609 profile.SetRawMultiInfo(EMAIL_ADDRESS, values); | 608 profile.SetRawMultiInfo(EMAIL_ADDRESS, values); |
| 610 | 609 |
| 611 ::google::protobuf::RepeatedPtrField<std::string> specifics_fields; | 610 ::google::protobuf::RepeatedPtrField<std::string> specifics_fields; |
| 612 specifics_fields.AddAllocated(new std::string("2@1.com")); | 611 specifics_fields.AddAllocated(new std::string("2@1.com")); |
| 613 specifics_fields.AddAllocated(new std::string("3@1.com")); | 612 specifics_fields.AddAllocated(new std::string("3@1.com")); |
| 614 | 613 |
| 615 EXPECT_TRUE(AutofillProfileSyncableService::UpdateMultivaluedField( | 614 EXPECT_TRUE(AutofillProfileSyncableService::UpdateMultivaluedField( |
| 616 EMAIL_ADDRESS, specifics_fields, &profile)); | 615 EMAIL_ADDRESS, specifics_fields, &profile)); |
| 617 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); | 616 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); |
| 618 ASSERT_TRUE(values.size() == 2); | 617 ASSERT_TRUE(values.size() == 2); |
| 619 EXPECT_EQ(values[0], UTF8ToUTF16("2@1.com")); | 618 EXPECT_EQ(values[0], ASCIIToUTF16("2@1.com")); |
| 620 EXPECT_EQ(values[1], UTF8ToUTF16("3@1.com")); | 619 EXPECT_EQ(values[1], ASCIIToUTF16("3@1.com")); |
| 621 | 620 |
| 622 EXPECT_FALSE(AutofillProfileSyncableService::UpdateMultivaluedField( | 621 EXPECT_FALSE(AutofillProfileSyncableService::UpdateMultivaluedField( |
| 623 EMAIL_ADDRESS, specifics_fields, &profile)); | 622 EMAIL_ADDRESS, specifics_fields, &profile)); |
| 624 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); | 623 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); |
| 625 ASSERT_EQ(values.size(), 2U); | 624 ASSERT_EQ(values.size(), 2U); |
| 626 EXPECT_EQ(values[0], UTF8ToUTF16("2@1.com")); | 625 EXPECT_EQ(values[0], ASCIIToUTF16("2@1.com")); |
| 627 EXPECT_EQ(values[1], UTF8ToUTF16("3@1.com")); | 626 EXPECT_EQ(values[1], ASCIIToUTF16("3@1.com")); |
| 628 EXPECT_TRUE(AutofillProfileSyncableService::UpdateMultivaluedField( | 627 EXPECT_TRUE(AutofillProfileSyncableService::UpdateMultivaluedField( |
| 629 EMAIL_ADDRESS, ::google::protobuf::RepeatedPtrField<std::string>(), | 628 EMAIL_ADDRESS, ::google::protobuf::RepeatedPtrField<std::string>(), |
| 630 &profile)); | 629 &profile)); |
| 631 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); | 630 profile.GetRawMultiInfo(EMAIL_ADDRESS, &values); |
| 632 ASSERT_EQ(values.size(), 1U); // Always have at least an empty string. | 631 ASSERT_EQ(values.size(), 1U); // Always have at least an empty string. |
| 633 EXPECT_EQ(values[0], UTF8ToUTF16("")); | 632 EXPECT_EQ(values[0], ASCIIToUTF16("")); |
| 634 } | 633 } |
| 635 | 634 |
| 636 TEST_F(AutofillProfileSyncableServiceTest, MergeProfile) { | 635 TEST_F(AutofillProfileSyncableServiceTest, MergeProfile) { |
| 637 AutofillProfile profile1(kGuid1, kHttpOrigin); | 636 AutofillProfile profile1(kGuid1, kHttpOrigin); |
| 638 profile1.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("111 First St.")); | 637 profile1.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("111 First St.")); |
| 639 | 638 |
| 640 std::vector<base::string16> values; | 639 std::vector<base::string16> values; |
| 641 values.push_back(UTF8ToUTF16("1@1.com")); | 640 values.push_back(ASCIIToUTF16("1@1.com")); |
| 642 values.push_back(UTF8ToUTF16("2@1.com")); | 641 values.push_back(ASCIIToUTF16("2@1.com")); |
| 643 profile1.SetRawMultiInfo(EMAIL_ADDRESS, values); | 642 profile1.SetRawMultiInfo(EMAIL_ADDRESS, values); |
| 644 | 643 |
| 645 AutofillProfile profile2(kGuid2, kHttpsOrigin); | 644 AutofillProfile profile2(kGuid2, kHttpsOrigin); |
| 646 profile2.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("111 First St.")); | 645 profile2.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("111 First St.")); |
| 647 | 646 |
| 648 // |values| now is [ "1@1.com", "2@1.com", "3@1.com" ]. | 647 // |values| now is [ "1@1.com", "2@1.com", "3@1.com" ]. |
| 649 values.push_back(UTF8ToUTF16("3@1.com")); | 648 values.push_back(ASCIIToUTF16("3@1.com")); |
| 650 profile2.SetRawMultiInfo(EMAIL_ADDRESS, values); | 649 profile2.SetRawMultiInfo(EMAIL_ADDRESS, values); |
| 651 | 650 |
| 652 values.clear(); | 651 values.clear(); |
| 653 values.push_back(UTF8ToUTF16("John")); | 652 values.push_back(ASCIIToUTF16("John")); |
| 654 profile1.SetRawMultiInfo(NAME_FIRST, values); | 653 profile1.SetRawMultiInfo(NAME_FIRST, values); |
| 655 values.push_back(UTF8ToUTF16("Jane")); | 654 values.push_back(ASCIIToUTF16("Jane")); |
| 656 profile2.SetRawMultiInfo(NAME_FIRST, values); | 655 profile2.SetRawMultiInfo(NAME_FIRST, values); |
| 657 | 656 |
| 658 values.clear(); | 657 values.clear(); |
| 659 values.push_back(UTF8ToUTF16("Doe")); | 658 values.push_back(ASCIIToUTF16("Doe")); |
| 660 profile1.SetRawMultiInfo(NAME_LAST, values); | 659 profile1.SetRawMultiInfo(NAME_LAST, values); |
| 661 values.push_back(UTF8ToUTF16("Other")); | 660 values.push_back(ASCIIToUTF16("Other")); |
| 662 profile2.SetRawMultiInfo(NAME_LAST, values); | 661 profile2.SetRawMultiInfo(NAME_LAST, values); |
| 663 | 662 |
| 664 values.clear(); | 663 values.clear(); |
| 665 values.push_back(UTF8ToUTF16("650234567")); | 664 values.push_back(ASCIIToUTF16("650234567")); |
| 666 profile2.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); | 665 profile2.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); |
| 667 | 666 |
| 668 EXPECT_FALSE(AutofillProfileSyncableService::MergeProfile(profile2, | 667 EXPECT_FALSE(AutofillProfileSyncableService::MergeProfile(profile2, |
| 669 &profile1, | 668 &profile1, |
| 670 "en-US")); | 669 "en-US")); |
| 671 | 670 |
| 672 profile1.GetRawMultiInfo(NAME_FIRST, &values); | 671 profile1.GetRawMultiInfo(NAME_FIRST, &values); |
| 673 ASSERT_EQ(values.size(), 2U); | 672 ASSERT_EQ(values.size(), 2U); |
| 674 EXPECT_EQ(values[0], UTF8ToUTF16("John")); | 673 EXPECT_EQ(values[0], ASCIIToUTF16("John")); |
| 675 EXPECT_EQ(values[1], UTF8ToUTF16("Jane")); | 674 EXPECT_EQ(values[1], ASCIIToUTF16("Jane")); |
| 676 | 675 |
| 677 profile1.GetRawMultiInfo(NAME_LAST, &values); | 676 profile1.GetRawMultiInfo(NAME_LAST, &values); |
| 678 ASSERT_EQ(values.size(), 2U); | 677 ASSERT_EQ(values.size(), 2U); |
| 679 EXPECT_EQ(values[0], UTF8ToUTF16("Doe")); | 678 EXPECT_EQ(values[0], ASCIIToUTF16("Doe")); |
| 680 EXPECT_EQ(values[1], UTF8ToUTF16("Other")); | 679 EXPECT_EQ(values[1], ASCIIToUTF16("Other")); |
| 681 | 680 |
| 682 profile1.GetRawMultiInfo(EMAIL_ADDRESS, &values); | 681 profile1.GetRawMultiInfo(EMAIL_ADDRESS, &values); |
| 683 ASSERT_EQ(values.size(), 3U); | 682 ASSERT_EQ(values.size(), 3U); |
| 684 EXPECT_EQ(values[0], UTF8ToUTF16("1@1.com")); | 683 EXPECT_EQ(values[0], ASCIIToUTF16("1@1.com")); |
| 685 EXPECT_EQ(values[1], UTF8ToUTF16("2@1.com")); | 684 EXPECT_EQ(values[1], ASCIIToUTF16("2@1.com")); |
| 686 EXPECT_EQ(values[2], UTF8ToUTF16("3@1.com")); | 685 EXPECT_EQ(values[2], ASCIIToUTF16("3@1.com")); |
| 687 | 686 |
| 688 profile1.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); | 687 profile1.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); |
| 689 ASSERT_EQ(values.size(), 1U); | 688 ASSERT_EQ(values.size(), 1U); |
| 690 EXPECT_EQ(values[0], UTF8ToUTF16("650234567")); | 689 EXPECT_EQ(values[0], ASCIIToUTF16("650234567")); |
| 691 | 690 |
| 692 EXPECT_EQ(profile2.origin(), profile1.origin()); | 691 EXPECT_EQ(profile2.origin(), profile1.origin()); |
| 693 | 692 |
| 694 AutofillProfile profile3(kGuid3, kHttpOrigin); | 693 AutofillProfile profile3(kGuid3, kHttpOrigin); |
| 695 profile3.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("111 First St.")); | 694 profile3.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("111 First St.")); |
| 696 | 695 |
| 697 values.clear(); | 696 values.clear(); |
| 698 values.push_back(UTF8ToUTF16("Jane")); | 697 values.push_back(ASCIIToUTF16("Jane")); |
| 699 profile3.SetRawMultiInfo(NAME_FIRST, values); | 698 profile3.SetRawMultiInfo(NAME_FIRST, values); |
| 700 | 699 |
| 701 values.clear(); | 700 values.clear(); |
| 702 values.push_back(UTF8ToUTF16("Doe")); | 701 values.push_back(ASCIIToUTF16("Doe")); |
| 703 profile3.SetRawMultiInfo(NAME_LAST, values); | 702 profile3.SetRawMultiInfo(NAME_LAST, values); |
| 704 | 703 |
| 705 EXPECT_TRUE(AutofillProfileSyncableService::MergeProfile(profile3, | 704 EXPECT_TRUE(AutofillProfileSyncableService::MergeProfile(profile3, |
| 706 &profile1, | 705 &profile1, |
| 707 "en-US")); | 706 "en-US")); |
| 708 | 707 |
| 709 profile1.GetRawMultiInfo(NAME_FIRST, &values); | 708 profile1.GetRawMultiInfo(NAME_FIRST, &values); |
| 710 ASSERT_EQ(values.size(), 3U); | 709 ASSERT_EQ(values.size(), 3U); |
| 711 EXPECT_EQ(values[0], UTF8ToUTF16("John")); | 710 EXPECT_EQ(values[0], ASCIIToUTF16("John")); |
| 712 EXPECT_EQ(values[1], UTF8ToUTF16("Jane")); | 711 EXPECT_EQ(values[1], ASCIIToUTF16("Jane")); |
| 713 EXPECT_EQ(values[2], UTF8ToUTF16("Jane")); | 712 EXPECT_EQ(values[2], ASCIIToUTF16("Jane")); |
| 714 | 713 |
| 715 profile1.GetRawMultiInfo(NAME_LAST, &values); | 714 profile1.GetRawMultiInfo(NAME_LAST, &values); |
| 716 ASSERT_EQ(values.size(), 3U); | 715 ASSERT_EQ(values.size(), 3U); |
| 717 EXPECT_EQ(values[0], UTF8ToUTF16("Doe")); | 716 EXPECT_EQ(values[0], ASCIIToUTF16("Doe")); |
| 718 EXPECT_EQ(values[1], UTF8ToUTF16("Other")); | 717 EXPECT_EQ(values[1], ASCIIToUTF16("Other")); |
| 719 EXPECT_EQ(values[2], UTF8ToUTF16("Doe")); | 718 EXPECT_EQ(values[2], ASCIIToUTF16("Doe")); |
| 720 | 719 |
| 721 // Middle name should have three entries as well. | 720 // Middle name should have three entries as well. |
| 722 profile1.GetRawMultiInfo(NAME_MIDDLE, &values); | 721 profile1.GetRawMultiInfo(NAME_MIDDLE, &values); |
| 723 ASSERT_EQ(values.size(), 3U); | 722 ASSERT_EQ(values.size(), 3U); |
| 724 EXPECT_TRUE(values[0].empty()); | 723 EXPECT_TRUE(values[0].empty()); |
| 725 EXPECT_TRUE(values[1].empty()); | 724 EXPECT_TRUE(values[1].empty()); |
| 726 EXPECT_TRUE(values[2].empty()); | 725 EXPECT_TRUE(values[2].empty()); |
| 727 | 726 |
| 728 profile1.GetRawMultiInfo(EMAIL_ADDRESS, &values); | 727 profile1.GetRawMultiInfo(EMAIL_ADDRESS, &values); |
| 729 ASSERT_EQ(values.size(), 3U); | 728 ASSERT_EQ(values.size(), 3U); |
| 730 EXPECT_EQ(values[0], UTF8ToUTF16("1@1.com")); | 729 EXPECT_EQ(values[0], ASCIIToUTF16("1@1.com")); |
| 731 EXPECT_EQ(values[1], UTF8ToUTF16("2@1.com")); | 730 EXPECT_EQ(values[1], ASCIIToUTF16("2@1.com")); |
| 732 EXPECT_EQ(values[2], UTF8ToUTF16("3@1.com")); | 731 EXPECT_EQ(values[2], ASCIIToUTF16("3@1.com")); |
| 733 | 732 |
| 734 profile1.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); | 733 profile1.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); |
| 735 ASSERT_EQ(values.size(), 1U); | 734 ASSERT_EQ(values.size(), 1U); |
| 736 EXPECT_EQ(values[0], UTF8ToUTF16("650234567")); | 735 EXPECT_EQ(values[0], ASCIIToUTF16("650234567")); |
| 737 } | 736 } |
| 738 | 737 |
| 739 // Ensure that all profile fields are able to be synced up from the client to | 738 // Ensure that all profile fields are able to be synced up from the client to |
| 740 // the server. | 739 // the server. |
| 741 TEST_F(AutofillProfileSyncableServiceTest, SyncAllFieldsToServer) { | 740 TEST_F(AutofillProfileSyncableServiceTest, SyncAllFieldsToServer) { |
| 742 std::vector<AutofillProfile*> profiles_from_web_db; | 741 std::vector<AutofillProfile*> profiles_from_web_db; |
| 743 | 742 |
| 744 // Create a profile with all fields set. | 743 // Create a profile with all fields set. |
| 745 profiles_from_web_db.push_back(ConstructCompleteProfile().release()); | 744 profiles_from_web_db.push_back(ConstructCompleteProfile().release()); |
| 746 | 745 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 profile.guid(), profile.guid(), specifics)); | 868 profile.guid(), profile.guid(), specifics)); |
| 870 | 869 |
| 871 MockAutofillProfileSyncableService::DataBundle expected_bundle; | 870 MockAutofillProfileSyncableService::DataBundle expected_bundle; |
| 872 syncer::SyncChangeList expected_change_list; | 871 syncer::SyncChangeList expected_change_list; |
| 873 MergeDataAndStartSyncing( | 872 MergeDataAndStartSyncing( |
| 874 profiles_from_web_db, data_list, expected_bundle, expected_change_list); | 873 profiles_from_web_db, data_list, expected_bundle, expected_change_list); |
| 875 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); | 874 autofill_syncable_service_.StopSyncing(syncer::AUTOFILL_PROFILE); |
| 876 } | 875 } |
| 877 | 876 |
| 878 } // namespace autofill | 877 } // namespace autofill |
| OLD | NEW |