Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/autofill/core/browser/test_autofill_clock.h" | |
|
Mathieu
2017/01/31 18:19:37
could this be in common too?
sebsg
2017/01/31 21:55:56
I put it with all the other test utils used for te
| |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/test/simple_test_clock.h" | |
| 10 #include "components/autofill/core/common/autofill_clock.h" | |
| 11 | |
| 12 namespace autofill { | |
| 13 | |
| 14 TestAutofillClock::TestAutofillClock() { | |
| 15 // Create a new test clock and set it as the AutofillClock clock and keep a | |
|
Roger McFarlane (Chromium)
2017/01/31 19:05:54
indent -2, or maybe you've got tabs?
sebsg
2017/01/31 21:55:56
Done.
| |
| 16 // pointer to manipulate the time it returns. | |
| 17 std::unique_ptr<base::SimpleTestClock> unique_test_clock( | |
| 18 new base::SimpleTestClock()); | |
| 19 test_clock_ = unique_test_clock.get(); | |
|
Roger McFarlane (Chromium)
2017/01/31 19:05:54
this is kind of evil. Document that you're keeping
sebsg
2017/01/31 21:55:56
Done.
| |
| 20 AutofillClock::SetTestClock(std::move(unique_test_clock)); | |
| 21 } | |
| 22 | |
| 23 TestAutofillClock::~TestAutofillClock() { | |
| 24 // Destroys the test clock and resets a normal clock. | |
| 25 AutofillClock::SetClock(); | |
| 26 } | |
| 27 | |
| 28 void TestAutofillClock::SetNow(base::Time now) { | |
| 29 test_clock_->SetNow(now); | |
| 30 } | |
| 31 | |
| 32 } // namespace autofill | |
| OLD | NEW |