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

Unified Diff: chrome/browser/sync/profile_sync_service_autofill_unittest.cc

Issue 9585020: Cull autofill entries older than 60 days. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and added culling when the sync is off. Created 8 years, 9 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: chrome/browser/sync/profile_sync_service_autofill_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index c8827a373ee1b255f5908b15de2d5d2dbb8b4440..730eea24fda599ee5eefed06b813afc6bcf8767a 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -58,6 +58,7 @@
#include "testing/gmock/include/gmock/gmock.h"
using base::Time;
+using base::TimeDelta;
using base::WaitableEvent;
using browser_sync::AutofillDataTypeController;
using browser_sync::AutofillProfileDataTypeController;
@@ -544,21 +545,25 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
static AutofillEntry MakeAutofillEntry(const char* name,
const char* value,
- time_t timestamp0,
- time_t timestamp1) {
+ int time_shift0,
+ int time_shift1) {
+ // Time deep in the past would cause Autocomplete sync to discard the
+ // entries.
+ static Time base_time = Time::Now().LocalMidnight();
+
std::vector<Time> timestamps;
- if (timestamp0 > 0)
- timestamps.push_back(Time::FromTimeT(timestamp0));
- if (timestamp1 > 0)
- timestamps.push_back(Time::FromTimeT(timestamp1));
+ if (time_shift0 > 0)
+ timestamps.push_back(base_time + TimeDelta::FromSeconds(time_shift0));
+ if (time_shift1 > 0)
+ timestamps.push_back(base_time + TimeDelta::FromSeconds(time_shift1));
return AutofillEntry(
AutofillKey(ASCIIToUTF16(name), ASCIIToUTF16(value)), timestamps);
}
static AutofillEntry MakeAutofillEntry(const char* name,
const char* value,
- time_t timestamp) {
- return MakeAutofillEntry(name, value, timestamp, -1);
+ int time_shift) {
+ return MakeAutofillEntry(name, value, time_shift, -1);
}
friend class AddAutofillHelper<AutofillEntry>;

Powered by Google App Engine
This is Rietveld 408576698