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

Unified Diff: components/autofill/core/browser/autofill_profile_comparator_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_profile_comparator_unittest.cc
diff --git a/components/autofill/core/browser/autofill_profile_comparator_unittest.cc b/components/autofill/core/browser/autofill_profile_comparator_unittest.cc
index 36da4fdf765a50ecade966ae5ed874443eca27e3..47e371cb81a860333e948726ecac2b3634ee9772 100644
--- a/components/autofill/core/browser/autofill_profile_comparator_unittest.cc
+++ b/components/autofill/core/browser/autofill_profile_comparator_unittest.cc
@@ -6,6 +6,7 @@
#include "base/guid.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/autofill/core/browser/autofill_clock.h"
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/contact_info.h"
@@ -39,6 +40,7 @@ using autofill::PHONE_HOME_CITY_AND_NUMBER;
// Classes, Functions, and other Symbols
using autofill::Address;
+using autofill::AutofillClock;
using autofill::AutofillProfile;
using autofill::AutofillType;
using autofill::CompanyInfo;
@@ -698,15 +700,15 @@ TEST_F(AutofillProfileComparatorTest, MergeCJKNames) {
// the most recent profile if there is a conflict. The ordering is
// p1 > p2 > p3 > p4 > p5, with p1 being the most recent.
AutofillProfile p1 = CreateProfileWithName(name1);
- p1.set_use_date(base::Time::Now());
+ p1.set_use_date(AutofillClock::Now());
AutofillProfile p2 = CreateProfileWithName(name2);
- p2.set_use_date(base::Time::Now() - base::TimeDelta::FromHours(1));
+ p2.set_use_date(AutofillClock::Now() - base::TimeDelta::FromHours(1));
AutofillProfile p3 = CreateProfileWithName(name3);
- p3.set_use_date(base::Time::Now() - base::TimeDelta::FromHours(2));
+ p3.set_use_date(AutofillClock::Now() - base::TimeDelta::FromHours(2));
AutofillProfile p4 = CreateProfileWithName(name4);
- p4.set_use_date(base::Time::Now() - base::TimeDelta::FromHours(3));
+ p4.set_use_date(AutofillClock::Now() - base::TimeDelta::FromHours(3));
AutofillProfile p5 = CreateProfileWithName(name5);
- p5.set_use_date(base::Time::Now() - base::TimeDelta::FromHours(4));
+ p5.set_use_date(AutofillClock::Now() - base::TimeDelta::FromHours(4));
AutofillProfile p6 = CreateProfileWithName(name6);
AutofillProfile p7 = CreateProfileWithName(name7);
@@ -744,7 +746,7 @@ TEST_F(AutofillProfileComparatorTest, MergeEmailAddresses) {
EmailInfo email_a;
email_a.SetRawInfo(EMAIL_ADDRESS, UTF8ToUTF16(kEmailA));
AutofillProfile profile_a = CreateProfileWithEmail(kEmailA);
- profile_a.set_use_date(base::Time::Now());
+ profile_a.set_use_date(AutofillClock::Now());
EmailInfo email_b;
email_b.SetRawInfo(EMAIL_ADDRESS, UTF8ToUTF16(kEmailB));
@@ -765,7 +767,7 @@ TEST_F(AutofillProfileComparatorTest, MergeCompanyNames) {
CompanyInfo company_a;
company_a.SetRawInfo(COMPANY_NAME, UTF8ToUTF16(kCompanyA));
AutofillProfile profile_a = CreateProfileWithCompanyName(kCompanyA);
- profile_a.set_use_date(base::Time::Now());
+ profile_a.set_use_date(AutofillClock::Now());
// Company Name B is post_normalization identical to Company Name A. The use
// date will be used to choose between them.

Powered by Google App Engine
This is Rietveld 408576698