OLD | NEW |
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" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "components/autofill/core/browser/autofill_profile.h" | 15 #include "components/autofill/core/browser/autofill_profile.h" |
16 #include "components/autofill/core/browser/autofill_type.h" | 16 #include "components/autofill/core/browser/autofill_type.h" |
17 #include "components/autofill/core/browser/credit_card.h" | 17 #include "components/autofill/core/browser/credit_card.h" |
18 #include "components/autofill/core/browser/webdata/autofill_change.h" | 18 #include "components/autofill/core/browser/webdata/autofill_change.h" |
19 #include "components/autofill/core/browser/webdata/autofill_entry.h" | 19 #include "components/autofill/core/browser/webdata/autofill_entry.h" |
20 #include "components/autofill/core/browser/webdata/autofill_table.h" | 20 #include "components/autofill/core/browser/webdata/autofill_table.h" |
21 #include "components/autofill/core/common/form_field_data.h" | 21 #include "components/autofill/core/common/form_field_data.h" |
22 #include "components/encryptor/encryptor.h" | 22 #include "components/encryptor/os_crypt.h" |
23 #include "components/webdata/common/web_database.h" | 23 #include "components/webdata/common/web_database.h" |
24 #include "sql/statement.h" | 24 #include "sql/statement.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 using base::ASCIIToUTF16; | 27 using base::ASCIIToUTF16; |
28 using base::Time; | 28 using base::Time; |
29 using base::TimeDelta; | 29 using base::TimeDelta; |
30 | 30 |
31 namespace autofill { | 31 namespace autofill { |
32 | 32 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 class AutofillTableTest : public testing::Test { | 124 class AutofillTableTest : public testing::Test { |
125 public: | 125 public: |
126 AutofillTableTest() {} | 126 AutofillTableTest() {} |
127 virtual ~AutofillTableTest() {} | 127 virtual ~AutofillTableTest() {} |
128 | 128 |
129 protected: | 129 protected: |
130 virtual void SetUp() { | 130 virtual void SetUp() { |
131 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
132 Encryptor::UseMockKeychain(true); | 132 OSCrypt::UseMockKeychain(true); |
133 #endif | 133 #endif |
134 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 134 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
135 file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); | 135 file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); |
136 | 136 |
137 table_.reset(new AutofillTable("en-US")); | 137 table_.reset(new AutofillTable("en-US")); |
138 db_.reset(new WebDatabase); | 138 db_.reset(new WebDatabase); |
139 db_->AddTable(table_.get()); | 139 db_->AddTable(table_.get()); |
140 ASSERT_EQ(sql::INIT_OK, db_->Init(file_)); | 140 ASSERT_EQ(sql::INIT_OK, db_->Init(file_)); |
141 } | 141 } |
142 | 142 |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 | 1606 |
1607 std::vector<AutofillEntry> entries; | 1607 std::vector<AutofillEntry> entries; |
1608 ASSERT_TRUE(table_->GetAllAutofillEntries(&entries)); | 1608 ASSERT_TRUE(table_->GetAllAutofillEntries(&entries)); |
1609 AutofillEntrySet entry_set(entries.begin(), entries.end(), | 1609 AutofillEntrySet entry_set(entries.begin(), entries.end(), |
1610 CompareAutofillEntries); | 1610 CompareAutofillEntries); |
1611 | 1611 |
1612 CompareAutofillEntrySets(entry_set, expected_entries); | 1612 CompareAutofillEntrySets(entry_set, expected_entries); |
1613 } | 1613 } |
1614 | 1614 |
1615 } // namespace autofill | 1615 } // namespace autofill |
OLD | NEW |