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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table_unittest.cc

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 home_profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 Apple Way")); 643 home_profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 Apple Way"));
644 home_profile.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("unit 5")); 644 home_profile.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("unit 5"));
645 home_profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, 645 home_profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY,
646 ASCIIToUTF16("Beverly Hills")); 646 ASCIIToUTF16("Beverly Hills"));
647 home_profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Los Angeles")); 647 home_profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Los Angeles"));
648 home_profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); 648 home_profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA"));
649 home_profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025")); 649 home_profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025"));
650 home_profile.SetRawInfo(ADDRESS_HOME_SORTING_CODE, ASCIIToUTF16("MAGIC ###")); 650 home_profile.SetRawInfo(ADDRESS_HOME_SORTING_CODE, ASCIIToUTF16("MAGIC ###"));
651 home_profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); 651 home_profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
652 home_profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567")); 652 home_profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567"));
653 home_profile.set_language_code("en");
653 654
654 Time pre_creation_time = Time::Now(); 655 Time pre_creation_time = Time::Now();
655 EXPECT_TRUE(table_->AddAutofillProfile(home_profile)); 656 EXPECT_TRUE(table_->AddAutofillProfile(home_profile));
656 Time post_creation_time = Time::Now(); 657 Time post_creation_time = Time::Now();
657 658
658 // Get the 'Home' profile. 659 // Get the 'Home' profile.
659 AutofillProfile* db_profile; 660 AutofillProfile* db_profile;
660 ASSERT_TRUE(table_->GetAutofillProfile(home_profile.guid(), &db_profile)); 661 ASSERT_TRUE(table_->GetAutofillProfile(home_profile.guid(), &db_profile));
661 EXPECT_EQ(home_profile, *db_profile); 662 EXPECT_EQ(home_profile, *db_profile);
662 sql::Statement s_home(db_->GetSQLConnection()->GetUniqueStatement( 663 sql::Statement s_home(db_->GetSQLConnection()->GetUniqueStatement(
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith")); 1047 profile.SetRawInfo(NAME_LAST, ASCIIToUTF16("Smith"));
1047 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("js@example.com")); 1048 profile.SetRawInfo(EMAIL_ADDRESS, ASCIIToUTF16("js@example.com"));
1048 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Google")); 1049 profile.SetRawInfo(COMPANY_NAME, ASCIIToUTF16("Google"));
1049 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 Apple Way")); 1050 profile.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("1234 Apple Way"));
1050 profile.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("unit 5")); 1051 profile.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("unit 5"));
1051 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Los Angeles")); 1052 profile.SetRawInfo(ADDRESS_HOME_CITY, ASCIIToUTF16("Los Angeles"));
1052 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA")); 1053 profile.SetRawInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("CA"));
1053 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025")); 1054 profile.SetRawInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16("90025"));
1054 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); 1055 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US"));
1055 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567")); 1056 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("18181234567"));
1057 profile.set_language_code("en");
1056 table_->AddAutofillProfile(profile); 1058 table_->AddAutofillProfile(profile);
1057 1059
1058 // Set a mocked value for the profile's creation time. 1060 // Set a mocked value for the profile's creation time.
1059 const time_t kMockCreationDate = Time::Now().ToTimeT() - 13; 1061 const time_t kMockCreationDate = Time::Now().ToTimeT() - 13;
1060 sql::Statement s_mock_creation_date( 1062 sql::Statement s_mock_creation_date(
1061 db_->GetSQLConnection()->GetUniqueStatement( 1063 db_->GetSQLConnection()->GetUniqueStatement(
1062 "UPDATE autofill_profiles SET date_modified = ?")); 1064 "UPDATE autofill_profiles SET date_modified = ?"));
1063 ASSERT_TRUE(s_mock_creation_date.is_valid()); 1065 ASSERT_TRUE(s_mock_creation_date.is_valid());
1064 s_mock_creation_date.BindInt64(0, kMockCreationDate); 1066 s_mock_creation_date.BindInt64(0, kMockCreationDate);
1065 ASSERT_TRUE(s_mock_creation_date.Run()); 1067 ASSERT_TRUE(s_mock_creation_date.Run());
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 1599
1598 std::vector<AutofillEntry> entries; 1600 std::vector<AutofillEntry> entries;
1599 ASSERT_TRUE(table_->GetAllAutofillEntries(&entries)); 1601 ASSERT_TRUE(table_->GetAllAutofillEntries(&entries));
1600 AutofillEntrySet entry_set(entries.begin(), entries.end(), 1602 AutofillEntrySet entry_set(entries.begin(), entries.end(),
1601 CompareAutofillEntries); 1603 CompareAutofillEntries);
1602 1604
1603 CompareAutofillEntrySets(entry_set, expected_entries); 1605 CompareAutofillEntrySets(entry_set, expected_entries);
1604 } 1606 }
1605 1607
1606 } // namespace autofill 1608 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/webdata/autofill_table.cc ('k') | components/test/data/web_database/version_55.sql » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698