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

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)

Created:
3 years, 11 months ago by sebsg
Modified:
3 years, 9 months ago
CC:
chromium-reviews, rouslan+autofill_chromium.org, sebsg+autofillwatch_chromium.org, browser-components-watch_chromium.org, mathp+autofillwatch_chromium.org, vabr+watchlistautofill_chromium.org, estade+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Autofill] Remove direct use of base::Time::Now() in Autofill Adds a standard way to get the current time in Autofill. With the AutofillClock, it is now possible to inject a test clock that can return specific times when queried. I only made effective use of it in the PersonalDataManagerTest for now. BUG=682379 Review-Url: https://codereview.chromium.org/2639403002 Cr-Commit-Position: refs/heads/master@{#447572} Committed: https://chromium.googlesource.com/chromium/src/+/8c21ca772b51f0b9f12879713dd74a6b09d88316

Patch Set 1 #

Patch Set 2 : Rebase #

Total comments: 20

Patch Set 3 : Addressed comments #

Total comments: 14

Patch Set 4 : Addressed comments #

Patch Set 5 : Rebase #

Patch Set 6 : Added a scoped TestAutofillClock #

Total comments: 12

Patch Set 7 : Use LazyInstance #

Patch Set 8 : Rebase #

Total comments: 2

Patch Set 9 : Added DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+395 lines, -177 lines) Patch
M components/autofill/core/browser/BUILD.gn View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M components/autofill/core/browser/autofill_data_model.cc View 1 2 3 4 3 chunks +4 lines, -3 lines 0 comments Download
M components/autofill/core/browser/autofill_manager.cc View 1 2 3 4 5 6 7 4 chunks +4 lines, -3 lines 0 comments Download
M components/autofill/core/browser/autofill_profile.cc View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M components/autofill/core/browser/credit_card.cc View 1 2 5 chunks +7 lines, -6 lines 0 comments Download
M components/autofill/core/browser/credit_card_field.cc View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M components/autofill/core/browser/payments/full_card_request.cc View 1 2 5 chunks +5 lines, -4 lines 0 comments Download
M components/autofill/core/browser/personal_data_manager.cc View 1 2 3 4 8 chunks +9 lines, -7 lines 0 comments Download
M components/autofill/core/browser/personal_data_manager_unittest.cc View 1 2 3 4 5 6 7 77 chunks +166 lines, -126 lines 0 comments Download
A components/autofill/core/browser/test_autofill_clock.h View 1 2 3 4 5 6 1 chunk +39 lines, -0 lines 0 comments Download
A components/autofill/core/browser/test_autofill_clock.cc View 1 2 3 4 5 6 1 chunk +33 lines, -0 lines 0 comments Download
M components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc View 1 2 7 chunks +10 lines, -9 lines 0 comments Download
M components/autofill/core/browser/webdata/autofill_table.cc View 1 2 3 4 5 10 chunks +19 lines, -17 lines 0 comments Download
M components/autofill/core/common/BUILD.gn View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A components/autofill/core/common/autofill_clock.h View 1 2 3 4 5 6 1 chunk +48 lines, -0 lines 0 comments Download
A components/autofill/core/common/autofill_clock.cc View 1 2 3 4 5 6 7 8 1 chunk +43 lines, -0 lines 0 comments Download

Messages

Total messages: 90 (76 generated)
sebsg
Hi Math, PTAL?
3 years, 11 months ago (2017-01-25 17:44:10 UTC) #16
Mathieu
Up to you if you want to change things to AutofillClock in tests without yet ...
3 years, 11 months ago (2017-01-25 19:57:24 UTC) #23
sebsg
Thanks Math, another look? https://codereview.chromium.org/2639403002/diff/80001/components/autofill/core/browser/autofill_clock.cc File components/autofill/core/browser/autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/80001/components/autofill/core/browser/autofill_clock.cc#newcode1 components/autofill/core/browser/autofill_clock.cc:1: // Copyright 2013 The Chromium ...
3 years, 11 months ago (2017-01-25 21:35:27 UTC) #28
Mathieu
lgtm with nits https://codereview.chromium.org/2639403002/diff/160001/components/autofill/core/browser/personal_data_manager_unittest.cc File components/autofill/core/browser/personal_data_manager_unittest.cc (right): https://codereview.chromium.org/2639403002/diff/160001/components/autofill/core/browser/personal_data_manager_unittest.cc#newcode72 components/autofill/core/browser/personal_data_manager_unittest.cc:72: const base::Time kSecondArbitraryTestTime = base::Time::FromDoubleT(1000); nit: ...
3 years, 11 months ago (2017-01-25 22:32:14 UTC) #32
sebsg
Hi Math, adding Roger for his opinion too. Could you please take a look specifically ...
3 years, 10 months ago (2017-01-30 20:27:26 UTC) #65
Mathieu
lgtm https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc File components/autofill/core/browser/test_autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc#newcode5 components/autofill/core/browser/test_autofill_clock.cc:5: #include "components/autofill/core/browser/test_autofill_clock.h" could this be in common too? ...
3 years, 10 months ago (2017-01-31 18:19:37 UTC) #68
Roger McFarlane (Chromium)
run git cl format https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc File components/autofill/core/browser/test_autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc#newcode15 components/autofill/core/browser/test_autofill_clock.cc:15: // Create a new test ...
3 years, 10 months ago (2017-01-31 19:05:54 UTC) #69
sebsg
Hi Roger, PTAL? https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc File components/autofill/core/browser/test_autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/360001/components/autofill/core/browser/test_autofill_clock.cc#newcode5 components/autofill/core/browser/test_autofill_clock.cc:5: #include "components/autofill/core/browser/test_autofill_clock.h" On 2017/01/31 18:19:37, Mathieu ...
3 years, 10 months ago (2017-01-31 21:55:56 UTC) #73
Thaovy231011
On 2017/01/25 19:57:24, Mathieu Perreault wrote: > <font><font>Up cho bạn nếu bạn muốn thay đổi ...
3 years, 10 months ago (2017-02-01 00:10:17 UTC) #80
Roger McFarlane (Chromium)
lgtm https://codereview.chromium.org/2639403002/diff/420001/components/autofill/core/common/autofill_clock.cc File components/autofill/core/common/autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/420001/components/autofill/core/common/autofill_clock.cc#newcode38 components/autofill/core/common/autofill_clock.cc:38: void AutofillClock::SetTestClock(std::unique_ptr<base::Clock> clock) { DCHECK(clock != nullptr) ?
3 years, 10 months ago (2017-02-01 15:34:26 UTC) #81
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2639403002/440001
3 years, 10 months ago (2017-02-01 17:44:09 UTC) #84
sebsg
Thanks Roger, sending to CQ https://codereview.chromium.org/2639403002/diff/420001/components/autofill/core/common/autofill_clock.cc File components/autofill/core/common/autofill_clock.cc (right): https://codereview.chromium.org/2639403002/diff/420001/components/autofill/core/common/autofill_clock.cc#newcode38 components/autofill/core/common/autofill_clock.cc:38: void AutofillClock::SetTestClock(std::unique_ptr<base::Clock> clock) { ...
3 years, 10 months ago (2017-02-01 18:25:57 UTC) #85
commit-bot: I haz the power
Committed patchset #9 (id:440001) as https://chromium.googlesource.com/chromium/src/+/8c21ca772b51f0b9f12879713dd74a6b09d88316
3 years, 10 months ago (2017-02-01 19:20:51 UTC) #88
Thaovy231011
3 years, 9 months ago (2017-02-26 09:57:38 UTC) #90
Message was sent while issue was closed.

          

Powered by Google App Engine
This is Rietveld 408576698