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 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 field_trial_->group(); | 200 field_trial_->group(); |
201 } | 201 } |
202 | 202 |
203 // Should not be called more than once per test since it stashes the | 203 // Should not be called more than once per test since it stashes the |
204 // SuggestionsStore in |mock_suggestions_store_|. | 204 // SuggestionsStore in |mock_suggestions_store_|. |
205 SuggestionsService* CreateSuggestionsServiceWithMocks() { | 205 SuggestionsService* CreateSuggestionsServiceWithMocks() { |
206 mock_suggestions_store_ = new StrictMock<MockSuggestionsStore>(); | 206 mock_suggestions_store_ = new StrictMock<MockSuggestionsStore>(); |
207 mock_thumbnail_manager_ = new StrictMock<MockImageManager>(); | 207 mock_thumbnail_manager_ = new StrictMock<MockImageManager>(); |
208 mock_blacklist_store_ = new MockBlacklistStore(); | 208 mock_blacklist_store_ = new MockBlacklistStore(); |
209 return new SuggestionsService( | 209 return new SuggestionsService( |
210 request_context_, scoped_ptr<SuggestionsStore>(mock_suggestions_store_), | 210 request_context_.get(), |
| 211 scoped_ptr<SuggestionsStore>(mock_suggestions_store_), |
211 scoped_ptr<ImageManager>(mock_thumbnail_manager_), | 212 scoped_ptr<ImageManager>(mock_thumbnail_manager_), |
212 scoped_ptr<BlacklistStore>(mock_blacklist_store_)); | 213 scoped_ptr<BlacklistStore>(mock_blacklist_store_)); |
213 } | 214 } |
214 | 215 |
215 void FetchSuggestionsDataNoTimeoutHelper(bool interleaved_requests) { | 216 void FetchSuggestionsDataNoTimeoutHelper(bool interleaved_requests) { |
216 // Field trial enabled with a specific suggestions URL. | 217 // Field trial enabled with a specific suggestions URL. |
217 EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsCommonParams, | 218 EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsCommonParams, |
218 kFakeBlacklistPath, kFakeBlacklistUrlParam, false); | 219 kFakeBlacklistPath, kFakeBlacklistUrlParam, false); |
219 scoped_ptr<SuggestionsService> suggestions_service( | 220 scoped_ptr<SuggestionsService> suggestions_service( |
220 CreateSuggestionsServiceWithMocks()); | 221 CreateSuggestionsServiceWithMocks()); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 scoped_ptr<SuggestionsService> suggestions_service( | 589 scoped_ptr<SuggestionsService> suggestions_service( |
589 CreateSuggestionsServiceWithMocks()); | 590 CreateSuggestionsServiceWithMocks()); |
590 SuggestionsProfile suggestions = | 591 SuggestionsProfile suggestions = |
591 CreateSuggestionsProfileWithExpiryTimestamps(); | 592 CreateSuggestionsProfileWithExpiryTimestamps(); |
592 suggestions_service->SetDefaultExpiryTimestamp(&suggestions, | 593 suggestions_service->SetDefaultExpiryTimestamp(&suggestions, |
593 kTestDefaultExpiry); | 594 kTestDefaultExpiry); |
594 EXPECT_EQ(kTestSetExpiry, suggestions.suggestions(0).expiry_ts()); | 595 EXPECT_EQ(kTestSetExpiry, suggestions.suggestions(0).expiry_ts()); |
595 EXPECT_EQ(kTestDefaultExpiry, suggestions.suggestions(1).expiry_ts()); | 596 EXPECT_EQ(kTestDefaultExpiry, suggestions.suggestions(1).expiry_ts()); |
596 } | 597 } |
597 } // namespace suggestions | 598 } // namespace suggestions |
OLD | NEW |