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

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: Fixed clang 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 d46093b10a0e1d00e8b2e4135798a2d353e12a00..dd184730f97b0a05f28ed1157e4f29c96d108565 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