| Index: components/suggestions/suggestions_service_unittest.cc
|
| diff --git a/components/suggestions/suggestions_service_unittest.cc b/components/suggestions/suggestions_service_unittest.cc
|
| index 0d082ea4f83f7fa256bc922a4b4dd8ee96bce1c4..4b52fd8530920a52bf5690e1f437bfc94dbf5be9 100644
|
| --- a/components/suggestions/suggestions_service_unittest.cc
|
| +++ b/components/suggestions/suggestions_service_unittest.cc
|
| @@ -94,6 +94,23 @@ scoped_ptr<SuggestionsProfile> CreateSuggestionsProfile() {
|
| return profile.Pass();
|
| }
|
|
|
| +// Creates one suggestion with expiry timestamp and one without.
|
| +SuggestionsProfile CreateSuggestionsProfileWithExpiryTimestamps() {
|
| + int64 now = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch())
|
| + .ToInternalValue();
|
| + SuggestionsProfile profile;
|
| + ChromeSuggestion* suggestion = profile.add_suggestions();
|
| + suggestion->set_title(kTestTitle);
|
| + suggestion->set_url(kTestUrl);
|
| + suggestion->set_expiry_ts(now);
|
| +
|
| + suggestion = profile.add_suggestions();
|
| + suggestion->set_title(kTestTitle);
|
| + suggestion->set_url(kTestUrl);
|
| +
|
| + return profile;
|
| +}
|
| +
|
| class MockSuggestionsStore : public suggestions::SuggestionsStore {
|
| public:
|
| MOCK_METHOD1(LoadSuggestions, bool(SuggestionsProfile*));
|
| @@ -497,4 +514,19 @@ TEST_F(SuggestionsServiceTest, UpdateBlacklistDelay) {
|
| EXPECT_EQ(initial_delay, suggestions_service->blacklist_delay());
|
| }
|
|
|
| +TEST_F(SuggestionsServiceTest, CheckDefaultTimeStamps) {
|
| +
|
| + scoped_ptr<SuggestionsService> suggestions_service(
|
| + CreateSuggestionsServiceWithMocks());
|
| + SuggestionsProfile suggestions =
|
| + CreateSuggestionsProfileWithExpiryTimestamps();
|
| + int64 now_usec = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch())
|
| + .ToInternalValue();
|
| + int64 default_timestamp_usec = now_usec + kDefaultExpiryUsec;
|
| + suggestions_service->SetDefaultExpiryTimestamps(&suggestions,
|
| + default_timestamp_usec);
|
| +
|
| + EXPECT_NE(suggestions.suggestions(0).expiry_ts(), default_timestamp_usec);
|
| + EXPECT_EQ(suggestions.suggestions(1).expiry_ts(), default_timestamp_usec);
|
| +}
|
| } // namespace suggestions
|
|
|