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

Unified Diff: components/autofill/core/browser/webdata/autofill_table_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/webdata/autofill_table_unittest.cc
diff --git a/components/autofill/core/browser/webdata/autofill_table_unittest.cc b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
index cd93d2984515ddfaf6660826fb0b22aa8ee7c32d..2d8a375f8ac19f312cea75d81658b7623177d745 100644
--- a/components/autofill/core/browser/webdata/autofill_table_unittest.cc
+++ b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
@@ -23,6 +23,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.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/autofill_type.h"
@@ -158,7 +159,7 @@ TEST_F(AutofillTableTest, Autofill) {
FormFieldData field;
field.name = ASCIIToUTF16("Name");
field.value = ASCIIToUTF16("Superman");
- base::Time now = base::Time::Now();
+ base::Time now = AutofillClock::Now();
base::TimeDelta two_seconds = base::TimeDelta::FromSeconds(2);
EXPECT_TRUE(table_->AddFormFieldValue(field, &changes));
std::vector<base::string16> v;
@@ -1857,7 +1858,7 @@ TEST_F(AutofillTableTest, SetServerProfileUpdateUsageStats) {
// Update the usage stats; make sure they're reflected in GetServerProfiles.
inputs.back().set_use_count(4U);
- inputs.back().set_use_date(base::Time::Now());
+ inputs.back().set_use_date(AutofillClock::Now());
table_->UpdateServerAddressMetadata(inputs.back());
table_->GetServerProfiles(&outputs);
ASSERT_EQ(1u, outputs.size());
@@ -1895,7 +1896,7 @@ TEST_F(AutofillTableTest, SetServerProfileUpdateUsageStats) {
TEST_F(AutofillTableTest, DeleteUnmaskedCard) {
// This isn't the exact unmasked time, since the database will use the
// current time that it is called. The code below has to be approximate.
- base::Time unmasked_time = base::Time::Now();
+ base::Time unmasked_time = AutofillClock::Now();
// Add a masked card.
base::string16 masked_number = ASCIIToUTF16("1111");
@@ -1934,7 +1935,7 @@ TEST_F(AutofillTableTest, DeleteUnmaskedCard) {
// Delete data in the range of the last 24 hours.
// Fudge |now| to make sure it's strictly greater than the |now| that
// the database uses.
- base::Time now = base::Time::Now() + base::TimeDelta::FromSeconds(1);
+ base::Time now = AutofillClock::Now() + base::TimeDelta::FromSeconds(1);
ASSERT_TRUE(table_->RemoveAutofillDataModifiedBetween(
now - base::TimeDelta::FromDays(1), now,
&profile_guids, &credit_card_guids));

Powered by Google App Engine
This is Rietveld 408576698