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 <string> | 5 #include <string> |
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/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/webdata/keyword_table.h" | 17 #include "chrome/browser/webdata/keyword_table.h" |
18 #include "chrome/browser/webdata/logins_table.h" | 18 #include "chrome/browser/webdata/logins_table.h" |
19 #include "chrome/browser/webdata/token_service_table.h" | 19 #include "chrome/browser/webdata/token_service_table.h" |
20 #include "chrome/browser/webdata/web_apps_table.h" | 20 #include "chrome/browser/webdata/web_apps_table.h" |
21 #include "chrome/browser/webdata/web_intents_table.h" | 21 #include "chrome/browser/webdata/web_intents_table.h" |
22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
23 #include "components/autofill/browser/autofill_country.h" | |
23 #include "components/autofill/browser/autofill_profile.h" | 24 #include "components/autofill/browser/autofill_profile.h" |
24 #include "components/autofill/browser/autofill_type.h" | 25 #include "components/autofill/browser/autofill_type.h" |
25 #include "components/autofill/browser/credit_card.h" | 26 #include "components/autofill/browser/credit_card.h" |
26 #include "components/webdata/autofill/autofill_change.h" | 27 #include "components/webdata/autofill/autofill_change.h" |
27 #include "components/webdata/autofill/autofill_entry.h" | 28 #include "components/webdata/autofill/autofill_entry.h" |
28 #include "components/webdata/autofill/autofill_table.h" | 29 #include "components/webdata/autofill/autofill_table.h" |
29 #include "components/webdata/common/web_database.h" | 30 #include "components/webdata/common/web_database.h" |
30 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
31 #include "sql/statement.h" | 32 #include "sql/statement.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
50 profile->SetRawInfo(NAME_FIRST, s.ColumnString16(2)); | 51 profile->SetRawInfo(NAME_FIRST, s.ColumnString16(2)); |
51 profile->SetRawInfo(NAME_MIDDLE, s.ColumnString16(3)); | 52 profile->SetRawInfo(NAME_MIDDLE, s.ColumnString16(3)); |
52 profile->SetRawInfo(NAME_LAST, s.ColumnString16(4)); | 53 profile->SetRawInfo(NAME_LAST, s.ColumnString16(4)); |
53 profile->SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(5)); | 54 profile->SetRawInfo(EMAIL_ADDRESS, s.ColumnString16(5)); |
54 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(6)); | 55 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(6)); |
55 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(7)); | 56 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(7)); |
56 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(8)); | 57 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(8)); |
57 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(9)); | 58 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(9)); |
58 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(10)); | 59 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(10)); |
59 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11)); | 60 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(11)); |
60 profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12)); | 61 profile->SetRawInfo( |
62 ADDRESS_HOME_COUNTRY, | |
63 ASCIIToUTF16( | |
64 AutofillCountry::GetCountryCode(s.ColumnString16(12), "en-US"))); | |
Ilya Sherman
2013/04/05 05:18:01
Please use SetInfo() for this.
jam
2013/04/05 06:45:54
Done.
| |
61 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); | 65 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); |
62 *date_modified = s.ColumnInt64(15); | 66 *date_modified = s.ColumnInt64(15); |
63 profile->set_guid(s.ColumnString(16)); | 67 profile->set_guid(s.ColumnString(16)); |
64 EXPECT_TRUE(base::IsValidGUID(profile->guid())); | 68 EXPECT_TRUE(base::IsValidGUID(profile->guid())); |
65 } | 69 } |
66 | 70 |
67 void AutofillProfile33FromStatement(const sql::Statement& s, | 71 void AutofillProfile33FromStatement(const sql::Statement& s, |
68 AutofillProfile* profile, | 72 AutofillProfile* profile, |
69 int64* date_modified) { | 73 int64* date_modified) { |
70 DCHECK(profile); | 74 DCHECK(profile); |
71 DCHECK(date_modified); | 75 DCHECK(date_modified); |
72 profile->set_guid(s.ColumnString(0)); | 76 profile->set_guid(s.ColumnString(0)); |
73 EXPECT_TRUE(base::IsValidGUID(profile->guid())); | 77 EXPECT_TRUE(base::IsValidGUID(profile->guid())); |
74 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(1)); | 78 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(1)); |
75 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(2)); | 79 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(2)); |
76 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); | 80 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); |
77 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); | 81 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); |
78 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); | 82 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); |
79 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); | 83 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); |
80 profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7)); | 84 profile->SetRawInfo( |
85 ADDRESS_HOME_COUNTRY, | |
86 ASCIIToUTF16( | |
87 AutofillCountry::GetCountryCode(s.ColumnString16(7), "en-US"))); | |
Ilya Sherman
2013/04/05 05:18:01
Please use SetInfo() for this.
jam
2013/04/05 06:45:54
Done.
| |
81 *date_modified = s.ColumnInt64(8); | 88 *date_modified = s.ColumnInt64(8); |
82 } | 89 } |
83 | 90 |
84 void CreditCard31FromStatement(const sql::Statement& s, | 91 void CreditCard31FromStatement(const sql::Statement& s, |
85 CreditCard* credit_card, | 92 CreditCard* credit_card, |
86 string16* label, | 93 string16* label, |
87 int* unique_id, | 94 int* unique_id, |
88 std::string* encrypted_number, | 95 std::string* encrypted_number, |
89 int64* date_modified) { | 96 int64* date_modified) { |
90 DCHECK(credit_card); | 97 DCHECK(credit_card); |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1982 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); | 1989 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); |
1983 | 1990 |
1984 // Check version. | 1991 // Check version. |
1985 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 1992 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
1986 | 1993 |
1987 // A new column should have been created. | 1994 // A new column should have been created. |
1988 EXPECT_TRUE(connection.DoesColumnExist("keywords", | 1995 EXPECT_TRUE(connection.DoesColumnExist("keywords", |
1989 "search_terms_replacement_key")); | 1996 "search_terms_replacement_key")); |
1990 } | 1997 } |
1991 } | 1998 } |
OLD | NEW |