| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "components/browsing_data/core/counters/autofill_counter.h" | 5 #include "components/browsing_data/core/counters/autofill_counter.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void ClearAutocompleteSuggestions() { | 62 void ClearAutocompleteSuggestions() { |
| 63 web_data_service_->RemoveFormElementsAddedBetween( | 63 web_data_service_->RemoveFormElementsAddedBetween( |
| 64 base::Time(), base::Time::Max()); | 64 base::Time(), base::Time::Max()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Credit cards -------------------------------------------------------------- | 67 // Credit cards -------------------------------------------------------------- |
| 68 | 68 |
| 69 void AddCreditCard(const std::string& card_number, | 69 void AddCreditCard(const std::string& card_number, |
| 70 int exp_month, | 70 int exp_month, |
| 71 int exp_year) { | 71 int exp_year) { |
| 72 autofill::CreditCard card( | 72 autofill::CreditCard card(base::GenerateGUID(), std::string()); |
| 73 base::ASCIIToUTF16(card_number), exp_month, exp_year); | 73 card.SetNumber(base::ASCIIToUTF16(card_number)); |
| 74 std::string id = base::GenerateGUID(); | 74 card.SetExpirationMonth(exp_month); |
| 75 credit_card_ids_.push_back(id); | 75 card.SetExpirationYear(exp_year); |
| 76 card.set_guid(id); | 76 credit_card_ids_.push_back(card.guid()); |
| 77 web_data_service_->AddCreditCard(card); | 77 web_data_service_->AddCreditCard(card); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void RemoveLastCreditCard() { | 80 void RemoveLastCreditCard() { |
| 81 web_data_service_->RemoveCreditCard(credit_card_ids_.back()); | 81 web_data_service_->RemoveCreditCard(credit_card_ids_.back()); |
| 82 credit_card_ids_.pop_back(); | 82 credit_card_ids_.pop_back(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Addresses ----------------------------------------------------------------- | 85 // Addresses ----------------------------------------------------------------- |
| 86 | 86 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 counter.SetPeriodStartForTesting(test_case.period_start); | 404 counter.SetPeriodStartForTesting(test_case.period_start); |
| 405 counter.Restart(); | 405 counter.Restart(); |
| 406 WaitForCounting(); | 406 WaitForCounting(); |
| 407 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); | 407 EXPECT_EQ(test_case.expected_num_suggestions, GetNumSuggestions()); |
| 408 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); | 408 EXPECT_EQ(test_case.expected_num_credit_cards, GetNumCreditCards()); |
| 409 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); | 409 EXPECT_EQ(test_case.expected_num_addresses, GetNumAddresses()); |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace | 413 } // namespace |
| OLD | NEW |