Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: components/browser_sync/browser/profile_sync_service_autofill_unittest.cc

Issue 1891903002: [Autofill] Set basic information when adding a new profiles and credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 EXPECT_EQ(0, sync_profile.Compare(new_sync_profiles[0])); 978 EXPECT_EQ(0, sync_profile.Compare(new_sync_profiles[0]));
979 } 979 }
980 980
981 TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfileCombine) { 981 TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfileCombine) {
982 AutofillProfile sync_profile; 982 AutofillProfile sync_profile;
983 autofill::test::SetProfileInfoWithGuid(&sync_profile, 983 autofill::test::SetProfileInfoWithGuid(&sync_profile,
984 "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing", 984 "23355099-1170-4B71-8ED4-144470CC9EBE", "Billing",
985 "Mitchell", "Morrison", 985 "Mitchell", "Morrison",
986 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", 986 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
987 "91601", "US", "12345678910"); 987 "91601", "US", "12345678910");
988 sync_profile.set_use_date(base::Time());
Mathieu 2016/04/19 14:29:35 can we have non zero use dates here and see what h
sebsg 2016/04/20 20:25:46 Done.
988 989
989 AutofillProfile* native_profile = new AutofillProfile; 990 AutofillProfile* native_profile = new AutofillProfile;
990 // Same address, but different names, phones and e-mails. 991 // Same address, but different names, phones and e-mails.
991 autofill::test::SetProfileInfoWithGuid(native_profile, 992 autofill::test::SetProfileInfoWithGuid(native_profile,
992 "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "Alicia", "Saenz", 993 "23355099-1170-4B71-8ED4-144470CC9EBF", "Billing", "Alicia", "Saenz",
993 "joewayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", 994 "joewayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
994 "91601", "US", "19482937549"); 995 "91601", "US", "19482937549");
996 native_profile->set_use_date(base::Time());
995 997
996 AutofillProfile expected_profile(sync_profile); 998 AutofillProfile expected_profile(sync_profile);
997 expected_profile.OverwriteWith(*native_profile, "en-US"); 999 expected_profile.OverwriteWith(*native_profile, "en-US");
998 1000
999 std::vector<AutofillProfile*> native_profiles; 1001 std::vector<AutofillProfile*> native_profiles;
1000 native_profiles.push_back(native_profile); 1002 native_profiles.push_back(native_profile);
1001 EXPECT_CALL(autofill_table(), GetAutofillProfiles(_)) 1003 EXPECT_CALL(autofill_table(), GetAutofillProfiles(_))
1002 .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true))); 1004 .WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
1003 EXPECT_CALL(autofill_table(), 1005 EXPECT_CALL(autofill_table(),
1004 AddAutofillProfile(MatchProfiles(expected_profile))) 1006 AddAutofillProfile(MatchProfiles(expected_profile)))
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 std::vector<AutofillEntry> sync_entries; 1257 std::vector<AutofillEntry> sync_entries;
1256 std::vector<AutofillProfile> sync_profiles; 1258 std::vector<AutofillProfile> sync_profiles;
1257 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1259 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1258 EXPECT_EQ(3U, sync_entries.size()); 1260 EXPECT_EQ(3U, sync_entries.size());
1259 EXPECT_EQ(0U, sync_profiles.size()); 1261 EXPECT_EQ(0U, sync_profiles.size());
1260 for (size_t i = 0; i < sync_entries.size(); i++) { 1262 for (size_t i = 0; i < sync_entries.size(); i++) {
1261 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1263 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1262 << ", " << sync_entries[i].key().value(); 1264 << ", " << sync_entries[i].key().value();
1263 } 1265 }
1264 } 1266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698