| 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 <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/guid.h" | 9 #include "base/guid.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/autofill/autofill_profile.h" | 14 #include "chrome/browser/autofill/autofill_profile.h" |
| 15 #include "chrome/browser/autofill/autofill_type.h" | 15 #include "chrome/browser/autofill/autofill_type.h" |
| 16 #include "chrome/browser/autofill/credit_card.h" | 16 #include "chrome/browser/autofill/credit_card.h" |
| 17 #include "chrome/browser/password_manager/encryptor.h" | 17 #include "chrome/browser/password_manager/encryptor.h" |
| 18 #include "chrome/browser/webdata/autofill_change.h" | 18 #include "chrome/browser/webdata/autofill_change.h" |
| 19 #include "chrome/browser/webdata/autofill_entry.h" | 19 #include "chrome/browser/webdata/autofill_entry.h" |
| 20 #include "chrome/browser/webdata/autofill_table.h" | 20 #include "chrome/browser/webdata/autofill_table.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 std::vector<Time> timestamps; | 108 std::vector<Time> timestamps; |
| 109 if (timestamp0 >= 0) | 109 if (timestamp0 >= 0) |
| 110 timestamps.push_back(Time::FromTimeT(timestamp0)); | 110 timestamps.push_back(Time::FromTimeT(timestamp0)); |
| 111 if (timestamp1 >= 0) | 111 if (timestamp1 >= 0) |
| 112 timestamps.push_back(Time::FromTimeT(timestamp1)); | 112 timestamps.push_back(Time::FromTimeT(timestamp1)); |
| 113 return AutofillEntry( | 113 return AutofillEntry( |
| 114 AutofillKey(ASCIIToUTF16(name), ASCIIToUTF16(value)), timestamps); | 114 AutofillKey(ASCIIToUTF16(name), ASCIIToUTF16(value)), timestamps); |
| 115 } | 115 } |
| 116 | 116 |
| 117 FilePath file_; | 117 FilePath file_; |
| 118 ScopedTempDir temp_dir_; | 118 base::ScopedTempDir temp_dir_; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 DISALLOW_COPY_AND_ASSIGN(AutofillTableTest); | 121 DISALLOW_COPY_AND_ASSIGN(AutofillTableTest); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 TEST_F(AutofillTableTest, Autofill) { | 124 TEST_F(AutofillTableTest, Autofill) { |
| 125 WebDatabase db; | 125 WebDatabase db; |
| 126 | 126 |
| 127 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); | 127 ASSERT_EQ(sql::INIT_OK, db.Init(file_)); |
| 128 | 128 |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 | 1436 |
| 1437 // make sure the lists of entries match | 1437 // make sure the lists of entries match |
| 1438 ASSERT_EQ(expected_entries.size(), entry_set.size()); | 1438 ASSERT_EQ(expected_entries.size(), entry_set.size()); |
| 1439 AutofillEntrySetIterator it; | 1439 AutofillEntrySetIterator it; |
| 1440 for (it = entry_set.begin(); it != entry_set.end(); it++) { | 1440 for (it = entry_set.begin(); it != entry_set.end(); it++) { |
| 1441 expected_entries.erase(*it); | 1441 expected_entries.erase(*it); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 EXPECT_EQ(0U, expected_entries.size()); | 1444 EXPECT_EQ(0U, expected_entries.size()); |
| 1445 } | 1445 } |
| OLD | NEW |