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" | |
Ilya Sherman
2013/04/05 07:18:41
nit: Not needed?
jam
2013/04/05 07:35:35
Done.
| |
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->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(12), "en-US"); |
61 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); | 62 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, s.ColumnString16(13)); |
62 *date_modified = s.ColumnInt64(15); | 63 *date_modified = s.ColumnInt64(15); |
63 profile->set_guid(s.ColumnString(16)); | 64 profile->set_guid(s.ColumnString(16)); |
64 EXPECT_TRUE(base::IsValidGUID(profile->guid())); | 65 EXPECT_TRUE(base::IsValidGUID(profile->guid())); |
65 } | 66 } |
66 | 67 |
67 void AutofillProfile33FromStatement(const sql::Statement& s, | 68 void AutofillProfile33FromStatement(const sql::Statement& s, |
68 AutofillProfile* profile, | 69 AutofillProfile* profile, |
69 int64* date_modified) { | 70 int64* date_modified) { |
70 DCHECK(profile); | 71 DCHECK(profile); |
71 DCHECK(date_modified); | 72 DCHECK(date_modified); |
72 profile->set_guid(s.ColumnString(0)); | 73 profile->set_guid(s.ColumnString(0)); |
73 EXPECT_TRUE(base::IsValidGUID(profile->guid())); | 74 EXPECT_TRUE(base::IsValidGUID(profile->guid())); |
74 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(1)); | 75 profile->SetRawInfo(COMPANY_NAME, s.ColumnString16(1)); |
75 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(2)); | 76 profile->SetRawInfo(ADDRESS_HOME_LINE1, s.ColumnString16(2)); |
76 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); | 77 profile->SetRawInfo(ADDRESS_HOME_LINE2, s.ColumnString16(3)); |
77 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); | 78 profile->SetRawInfo(ADDRESS_HOME_CITY, s.ColumnString16(4)); |
78 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); | 79 profile->SetRawInfo(ADDRESS_HOME_STATE, s.ColumnString16(5)); |
79 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); | 80 profile->SetRawInfo(ADDRESS_HOME_ZIP, s.ColumnString16(6)); |
80 profile->SetRawInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7)); | 81 profile->SetInfo(ADDRESS_HOME_COUNTRY, s.ColumnString16(7), "en-US"); |
81 *date_modified = s.ColumnInt64(8); | 82 *date_modified = s.ColumnInt64(8); |
82 } | 83 } |
83 | 84 |
84 void CreditCard31FromStatement(const sql::Statement& s, | 85 void CreditCard31FromStatement(const sql::Statement& s, |
85 CreditCard* credit_card, | 86 CreditCard* credit_card, |
86 string16* label, | 87 string16* label, |
87 int* unique_id, | 88 int* unique_id, |
88 std::string* encrypted_number, | 89 std::string* encrypted_number, |
89 int64* date_modified) { | 90 int64* date_modified) { |
90 DCHECK(credit_card); | 91 DCHECK(credit_card); |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1982 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); | 1983 ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); |
1983 | 1984 |
1984 // Check version. | 1985 // Check version. |
1985 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); | 1986 EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); |
1986 | 1987 |
1987 // A new column should have been created. | 1988 // A new column should have been created. |
1988 EXPECT_TRUE(connection.DoesColumnExist("keywords", | 1989 EXPECT_TRUE(connection.DoesColumnExist("keywords", |
1989 "search_terms_replacement_key")); | 1990 "search_terms_replacement_key")); |
1990 } | 1991 } |
1991 } | 1992 } |
OLD | NEW |