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

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: if (!RemoveFormElementForID(pair_id)) 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 7974c580d8bd8859c24491d1e66bcb07dce9dc7b..f6802149bd9cf76e608c76f31d11c51c98d356b8 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;
@@ -542,21 +543,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