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

Unified Diff: components/autofill/core/browser/autofill_clock.h

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_clock.h
diff --git a/components/autofill/core/browser/autofill_clock.h b/components/autofill/core/browser/autofill_clock.h
new file mode 100644
index 0000000000000000000000000000000000000000..cacb5e3e95292009eb8d0e3e27561e5f31b6f1da
--- /dev/null
+++ b/components/autofill/core/browser/autofill_clock.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_
+#define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_
+
Mathieu 2017/01/25 19:57:24 include <memory>
sebsg 2017/01/25 21:35:27 Done.
+#include "base/gtest_prod_util.h"
+#include "base/lazy_instance.h"
+#include "base/macros.h"
+#include "base/memory/ptr_util.h"
Mathieu 2017/01/25 19:57:24 need?
sebsg 2017/01/25 21:35:27 Not anymore!
+
+namespace base {
+class Clock;
+class Time;
+} // namespace base
+
+namespace autofill {
+
+class AutofillClock {
+ public:
+ static base::Time Now();
+
+ AutofillClock();
+ ~AutofillClock();
+ AutofillClock(AutofillClock const&) = delete;
Mathieu 2017/01/25 19:57:24 is that DISALLOW_COPY_AND_ASSIGN?
sebsg 2017/01/25 21:35:27 Done.
+ void operator=(AutofillClock const&) = delete;
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
Mathieu 2017/01/25 19:57:24 worried this will get cluttered... friend class
sebsg 2017/01/25 21:35:27 It was much easier that I thought, thanks for the
+ AddCreditCard_BasicInformation);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
+ AddProfile_BasicInformation);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, ApplyProfileUseDatesFix);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, DontDuplicateServerProfile);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, MergeProfile_UsageStats);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, RecordUseOf);
+ FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest,
+ UpdateServerCreditCardUsageStats);
+ static void SetClockForTests(base::Clock* clock);
+
+ std::unique_ptr<base::Clock> clock_;
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CLOCK_H_

Powered by Google App Engine
This is Rietveld 408576698