Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(596)

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 72d6f432b79a7ccfe549f4a9a6d8db4b34df1320..57845a835ecd047e04629d5458b31ab14ae5d616 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -30,6 +30,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
+#include "components/autofill/core/browser/autofill_clock.h"
#include "components/autofill/core/browser/autofill_download_manager.h"
#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/autofill_profile.h"
@@ -161,12 +162,12 @@ class TestPersonalDataManager : public PersonalDataManager {
}
void AddProfile(std::unique_ptr<AutofillProfile> profile) {
- profile->set_modification_date(base::Time::Now());
+ profile->set_modification_date(AutofillClock::Now());
web_profiles_.push_back(std::move(profile));
}
void AddCreditCard(std::unique_ptr<CreditCard> credit_card) {
- credit_card->set_modification_date(base::Time::Now());
+ credit_card->set_modification_date(AutofillClock::Now());
local_credit_cards_.push_back(std::move(credit_card));
}
@@ -282,7 +283,8 @@ class TestPersonalDataManager : public PersonalDataManager {
"04", "2999");
credit_card->set_guid("00000000-0000-0000-0000-000000000004");
credit_card->set_use_count(10);
- credit_card->set_use_date(base::Time::Now() - base::TimeDelta::FromDays(5));
+ credit_card->set_use_date(AutofillClock::Now() -
+ base::TimeDelta::FromDays(5));
credit_cards->push_back(std::move(credit_card));
credit_card = base::MakeUnique<CreditCard>();
@@ -291,7 +293,8 @@ class TestPersonalDataManager : public PersonalDataManager {
"10", "2998");
credit_card->set_guid("00000000-0000-0000-0000-000000000005");
credit_card->set_use_count(5);
- credit_card->set_use_date(base::Time::Now() - base::TimeDelta::FromDays(4));
+ credit_card->set_use_date(AutofillClock::Now() -
+ base::TimeDelta::FromDays(4));
credit_cards->push_back(std::move(credit_card));
credit_card = base::MakeUnique<CreditCard>();
@@ -1783,7 +1786,8 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestions_RepeatedObfuscatedNumber) {
"5231567890123456", // Mastercard
"05", "2999");
credit_card->set_guid("00000000-0000-0000-0000-000000000007");
- credit_card->set_use_date(base::Time::Now() - base::TimeDelta::FromDays(15));
+ credit_card->set_use_date(AutofillClock::Now() -
+ base::TimeDelta::FromDays(15));
autofill_manager_->AddCreditCard(std::move(credit_card));
// Set up our form data.

Powered by Google App Engine
This is Rietveld 408576698