| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/suggestions/suggestions_service.h" | 5 #include "components/suggestions/suggestions_service.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 suggestion->set_url(kTestUrl); | 106 suggestion->set_url(kTestUrl); |
| 107 | 107 |
| 108 return profile; | 108 return profile; |
| 109 } | 109 } |
| 110 | 110 |
| 111 class TestSuggestionsStore : public suggestions::SuggestionsStore { | 111 class TestSuggestionsStore : public suggestions::SuggestionsStore { |
| 112 public: | 112 public: |
| 113 TestSuggestionsStore() { | 113 TestSuggestionsStore() { |
| 114 cached_suggestions = CreateSuggestionsProfile(); | 114 cached_suggestions = CreateSuggestionsProfile(); |
| 115 } | 115 } |
| 116 virtual ~TestSuggestionsStore() {} | |
| 117 bool LoadSuggestions(SuggestionsProfile* suggestions) override { | 116 bool LoadSuggestions(SuggestionsProfile* suggestions) override { |
| 118 if (cached_suggestions.suggestions_size()) { | 117 if (cached_suggestions.suggestions_size()) { |
| 119 *suggestions = cached_suggestions; | 118 *suggestions = cached_suggestions; |
| 120 return true; | 119 return true; |
| 121 } | 120 } |
| 122 return false; | 121 return false; |
| 123 } | 122 } |
| 124 bool StoreSuggestions(const SuggestionsProfile& suggestions) | 123 bool StoreSuggestions(const SuggestionsProfile& suggestions) |
| 125 override { | 124 override { |
| 126 cached_suggestions = suggestions; | 125 cached_suggestions = suggestions; |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 scoped_ptr<SuggestionsService> suggestions_service( | 631 scoped_ptr<SuggestionsService> suggestions_service( |
| 633 CreateSuggestionsServiceWithMocks()); | 632 CreateSuggestionsServiceWithMocks()); |
| 634 SuggestionsProfile suggestions = | 633 SuggestionsProfile suggestions = |
| 635 CreateSuggestionsProfileWithExpiryTimestamps(); | 634 CreateSuggestionsProfileWithExpiryTimestamps(); |
| 636 suggestions_service->SetDefaultExpiryTimestamp(&suggestions, | 635 suggestions_service->SetDefaultExpiryTimestamp(&suggestions, |
| 637 kTestDefaultExpiry); | 636 kTestDefaultExpiry); |
| 638 EXPECT_EQ(kTestSetExpiry, suggestions.suggestions(0).expiry_ts()); | 637 EXPECT_EQ(kTestSetExpiry, suggestions.suggestions(0).expiry_ts()); |
| 639 EXPECT_EQ(kTestDefaultExpiry, suggestions.suggestions(1).expiry_ts()); | 638 EXPECT_EQ(kTestDefaultExpiry, suggestions.suggestions(1).expiry_ts()); |
| 640 } | 639 } |
| 641 } // namespace suggestions | 640 } // namespace suggestions |
| OLD | NEW |