Commit 32b55e89 authored by Elizabeth Popova's avatar Elizabeth Popova Committed by Chromium LUCI CQ

[Autofill] Use AutofillClock::Now in autofill_tets_utils

Using AutofillClock::Now was thought to be the cause of the flakiness of
the credit card related tests and was replaced with base::Time::Now
in [1]. However, the tests are still flaky, so this CL returns using
AutofillClock::Now, which allows having deterministic clock in tests.

[1]https://chromium-review.googlesource.com/c/chromium/src/+/2428986

Bug: 1108232
Change-Id: I052bb17926eda5537b7223f4d6c2c08432e3c215
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2613032Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Commit-Queue: Elizabeth Popova <lizapopova@google.com>
Cr-Commit-Position: refs/heads/master@{#842518}
parent 52b2c30f
......@@ -875,26 +875,22 @@ std::string ObfuscatedCardDigitsAsUTF8(const std::string& str) {
std::string NextMonth() {
base::Time::Exploded now;
// Using AutofillClock here might cause test flakiness. See crbug/1108232.
base::Time::Now().LocalExplode(&now);
AutofillClock::Now().LocalExplode(&now);
return base::StringPrintf("%02d", now.month % 12 + 1);
}
std::string LastYear() {
base::Time::Exploded now;
// Using AutofillClock here might cause test flakiness. See crbug/1108232.
base::Time::Now().LocalExplode(&now);
AutofillClock::Now().LocalExplode(&now);
return base::NumberToString(now.year - 1);
}
std::string NextYear() {
base::Time::Exploded now;
// Using AutofillClock here might cause test flakiness. See crbug/1108232.
base::Time::Now().LocalExplode(&now);
AutofillClock::Now().LocalExplode(&now);
return base::NumberToString(now.year + 1);
}
std::string TenYearsFromNow() {
base::Time::Exploded now;
// Using AutofillClock here might cause test flakiness. See crbug/1108232.
base::Time::Now().LocalExplode(&now);
AutofillClock::Now().LocalExplode(&now);
return base::NumberToString(now.year + 10);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment