| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/autofill/autofill_profile.h" | 12 #include "chrome/browser/autofill/autofill_profile.h" |
| 13 #include "chrome/browser/autofill/autofill_type.h" | 13 #include "chrome/browser/autofill/autofill_type.h" |
| 14 #include "chrome/browser/autofill/credit_card.h" | 14 #include "chrome/browser/autofill/credit_card.h" |
| 15 #include "chrome/browser/password_manager/encryptor.h" | 15 #include "chrome/browser/password_manager/encryptor.h" |
| 16 #include "chrome/browser/webdata/autofill_change.h" | 16 #include "chrome/browser/webdata/autofill_change.h" |
| 17 #include "chrome/browser/webdata/autofill_entry.h" | 17 #include "chrome/browser/webdata/autofill_entry.h" |
| 18 #include "chrome/browser/webdata/autofill_table.h" | 18 #include "chrome/browser/webdata/autofill_table.h" |
| 19 #include "chrome/browser/webdata/web_database.h" | 19 #include "chrome/browser/webdata/web_database.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/guid.h" | 21 #include "chrome/common/guid.h" |
| 22 #include "chrome/test/testing_browser_process_test.h" |
| 22 #include "sql/statement.h" | 23 #include "sql/statement.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "webkit/glue/form_field.h" | 25 #include "webkit/glue/form_field.h" |
| 25 | 26 |
| 26 using base::Time; | 27 using base::Time; |
| 27 using base::TimeDelta; | 28 using base::TimeDelta; |
| 28 using webkit_glue::FormField; | 29 using webkit_glue::FormField; |
| 29 | 30 |
| 30 // So we can compare AutofillKeys with EXPECT_EQ(). | 31 // So we can compare AutofillKeys with EXPECT_EQ(). |
| 31 std::ostream& operator<<(std::ostream& os, const AutofillKey& key) { | 32 std::ostream& operator<<(std::ostream& os, const AutofillKey& key) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 std::set<Time>::iterator it; | 75 std::set<Time>::iterator it; |
| 75 for (it = timestamps1.begin(); it != timestamps1.end(); it++) { | 76 for (it = timestamps1.begin(); it != timestamps1.end(); it++) { |
| 76 timestamps2.erase(*it); | 77 timestamps2.erase(*it); |
| 77 } | 78 } |
| 78 | 79 |
| 79 return !timestamps2.empty(); | 80 return !timestamps2.empty(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 } // anonymous namespace | 83 } // anonymous namespace |
| 83 | 84 |
| 84 class AutofillTableTest : public testing::Test { | 85 class AutofillTableTest : public TestingBrowserProcessTest { |
| 85 public: | 86 public: |
| 86 AutofillTableTest() {} | 87 AutofillTableTest() {} |
| 87 virtual ~AutofillTableTest() {} | 88 virtual ~AutofillTableTest() {} |
| 88 | 89 |
| 89 protected: | 90 protected: |
| 90 typedef std::vector<AutofillChange> AutofillChangeList; | 91 typedef std::vector<AutofillChange> AutofillChangeList; |
| 91 typedef std::set<AutofillEntry, | 92 typedef std::set<AutofillEntry, |
| 92 bool (*)(const AutofillEntry&, const AutofillEntry&)> AutofillEntrySet; | 93 bool (*)(const AutofillEntry&, const AutofillEntry&)> AutofillEntrySet; |
| 93 typedef std::set<AutofillEntry, bool (*)(const AutofillEntry&, | 94 typedef std::set<AutofillEntry, bool (*)(const AutofillEntry&, |
| 94 const AutofillEntry&)>::iterator AutofillEntrySetIterator; | 95 const AutofillEntry&)>::iterator AutofillEntrySetIterator; |
| (...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 | 1602 |
| 1602 // make sure the lists of entries match | 1603 // make sure the lists of entries match |
| 1603 ASSERT_EQ(expected_entries.size(), entry_set.size()); | 1604 ASSERT_EQ(expected_entries.size(), entry_set.size()); |
| 1604 AutofillEntrySetIterator it; | 1605 AutofillEntrySetIterator it; |
| 1605 for (it = entry_set.begin(); it != entry_set.end(); it++) { | 1606 for (it = entry_set.begin(); it != entry_set.end(); it++) { |
| 1606 expected_entries.erase(*it); | 1607 expected_entries.erase(*it); |
| 1607 } | 1608 } |
| 1608 | 1609 |
| 1609 EXPECT_EQ(0U, expected_entries.size()); | 1610 EXPECT_EQ(0U, expected_entries.size()); |
| 1610 } | 1611 } |
| OLD | NEW |