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/guid.h" |
8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
11 #include "base/time.h" | 12 #include "base/time.h" |
12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/autofill/autofill_profile.h" | 14 #include "chrome/browser/autofill/autofill_profile.h" |
14 #include "chrome/browser/autofill/autofill_type.h" | 15 #include "chrome/browser/autofill/autofill_type.h" |
15 #include "chrome/browser/autofill/credit_card.h" | 16 #include "chrome/browser/autofill/credit_card.h" |
16 #include "chrome/browser/password_manager/encryptor.h" | 17 #include "chrome/browser/password_manager/encryptor.h" |
17 #include "chrome/browser/webdata/autofill_change.h" | 18 #include "chrome/browser/webdata/autofill_change.h" |
18 #include "chrome/browser/webdata/autofill_entry.h" | 19 #include "chrome/browser/webdata/autofill_entry.h" |
19 #include "chrome/browser/webdata/autofill_table.h" | 20 #include "chrome/browser/webdata/autofill_table.h" |
20 #include "chrome/browser/webdata/web_database.h" | 21 #include "chrome/browser/webdata/web_database.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/guid.h" | |
23 #include "sql/statement.h" | 23 #include "sql/statement.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "webkit/forms/form_field.h" | 25 #include "webkit/forms/form_field.h" |
26 | 26 |
27 using base::Time; | 27 using base::Time; |
28 using base::TimeDelta; | 28 using base::TimeDelta; |
29 using webkit::forms::FormField; | 29 using webkit::forms::FormField; |
30 | 30 |
31 // So we can compare AutofillKeys with EXPECT_EQ(). | 31 // So we can compare AutofillKeys with EXPECT_EQ(). |
32 std::ostream& operator<<(std::ostream& os, const AutofillKey& key) { | 32 std::ostream& operator<<(std::ostream& os, const AutofillKey& key) { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 s_home.BindString(0, home_profile.guid()); | 574 s_home.BindString(0, home_profile.guid()); |
575 ASSERT_TRUE(s_home.is_valid()); | 575 ASSERT_TRUE(s_home.is_valid()); |
576 ASSERT_TRUE(s_home.Step()); | 576 ASSERT_TRUE(s_home.Step()); |
577 EXPECT_GE(s_home.ColumnInt64(0), pre_creation_time.ToTimeT()); | 577 EXPECT_GE(s_home.ColumnInt64(0), pre_creation_time.ToTimeT()); |
578 EXPECT_LE(s_home.ColumnInt64(0), post_creation_time.ToTimeT()); | 578 EXPECT_LE(s_home.ColumnInt64(0), post_creation_time.ToTimeT()); |
579 EXPECT_FALSE(s_home.Step()); | 579 EXPECT_FALSE(s_home.Step()); |
580 delete db_profile; | 580 delete db_profile; |
581 | 581 |
582 // Add a 'Billing' profile. | 582 // Add a 'Billing' profile. |
583 AutofillProfile billing_profile = home_profile; | 583 AutofillProfile billing_profile = home_profile; |
584 billing_profile.set_guid(guid::GenerateGUID()); | 584 billing_profile.set_guid(base::GenerateGUID()); |
585 billing_profile.SetInfo(ADDRESS_HOME_LINE1, | 585 billing_profile.SetInfo(ADDRESS_HOME_LINE1, |
586 ASCIIToUTF16("5678 Bottom Street")); | 586 ASCIIToUTF16("5678 Bottom Street")); |
587 billing_profile.SetInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("suite 3")); | 587 billing_profile.SetInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("suite 3")); |
588 | 588 |
589 pre_creation_time = Time::Now(); | 589 pre_creation_time = Time::Now(); |
590 EXPECT_TRUE(db.GetAutofillTable()->AddAutofillProfile(billing_profile)); | 590 EXPECT_TRUE(db.GetAutofillTable()->AddAutofillProfile(billing_profile)); |
591 post_creation_time = Time::Now(); | 591 post_creation_time = Time::Now(); |
592 | 592 |
593 // Get the 'Billing' profile. | 593 // Get the 'Billing' profile. |
594 ASSERT_TRUE(db.GetAutofillTable()->GetAutofillProfile( | 594 ASSERT_TRUE(db.GetAutofillTable()->GetAutofillProfile( |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 | 1432 |
1433 // make sure the lists of entries match | 1433 // make sure the lists of entries match |
1434 ASSERT_EQ(expected_entries.size(), entry_set.size()); | 1434 ASSERT_EQ(expected_entries.size(), entry_set.size()); |
1435 AutofillEntrySetIterator it; | 1435 AutofillEntrySetIterator it; |
1436 for (it = entry_set.begin(); it != entry_set.end(); it++) { | 1436 for (it = entry_set.begin(); it != entry_set.end(); it++) { |
1437 expected_entries.erase(*it); | 1437 expected_entries.erase(*it); |
1438 } | 1438 } |
1439 | 1439 |
1440 EXPECT_EQ(0U, expected_entries.size()); | 1440 EXPECT_EQ(0U, expected_entries.size()); |
1441 } | 1441 } |
OLD | NEW |