| Index: chrome/browser/search/suggestions/suggestions_service_unittest.cc
|
| diff --git a/chrome/browser/search/suggestions/suggestions_service_unittest.cc b/chrome/browser/search/suggestions/suggestions_service_unittest.cc
|
| index 674d7bc941b4c317cbd4eb517404d3ed5b82a2fe..71c726f2e0257b08f0750014f7c2b7d3e83699e5 100644
|
| --- a/chrome/browser/search/suggestions/suggestions_service_unittest.cc
|
| +++ b/chrome/browser/search/suggestions/suggestions_service_unittest.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/prefs/pref_service.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/history/history_types.h"
|
| +#include "chrome/browser/search/suggestions/blacklist_store.h"
|
| #include "chrome/browser/search/suggestions/proto/suggestions.pb.h"
|
| #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
|
| #include "chrome/browser/search/suggestions/suggestions_store.h"
|
| @@ -90,6 +91,13 @@ class MockSuggestionsStore : public suggestions::SuggestionsStore {
|
| MOCK_METHOD0(ClearSuggestions, void());
|
| };
|
|
|
| +class MockBlacklistStore : public suggestions::BlacklistStore {
|
| + public:
|
| + MOCK_METHOD1(BlacklistUrl, bool(const GURL&));
|
| + MOCK_METHOD1(RemoveUrl, bool(const GURL&));
|
| + MOCK_METHOD1(FilterSuggestions, void(SuggestionsProfile*));
|
| +};
|
| +
|
| } // namespace
|
|
|
| class SuggestionsServiceTest : public testing::Test {
|
| @@ -150,10 +158,12 @@ class SuggestionsServiceTest : public testing::Test {
|
|
|
| // Should not be called more than once per test since it stashes the
|
| // SuggestionsStore in |mock_suggestions_store_|.
|
| - SuggestionsService* CreateSuggestionsServiceWithMockStore() {
|
| + SuggestionsService* CreateSuggestionsServiceWithMocks() {
|
| mock_suggestions_store_ = new StrictMock<MockSuggestionsStore>();
|
| + mock_blacklist_store_ = new MockBlacklistStore();
|
| return new SuggestionsService(
|
| - profile_.get(), scoped_ptr<SuggestionsStore>(mock_suggestions_store_));
|
| + profile_.get(), scoped_ptr<SuggestionsStore>(mock_suggestions_store_),
|
| + scoped_ptr<BlacklistStore>(mock_blacklist_store_));
|
| }
|
|
|
| void FetchSuggestionsDataNoTimeoutHelper(bool interleaved_requests) {
|
| @@ -204,9 +214,9 @@ class SuggestionsServiceTest : public testing::Test {
|
|
|
| protected:
|
| net::FakeURLFetcherFactory factory_;
|
| - // Only used if the SuggestionsService is built with a MockSuggestionsStore.
|
| - // Not owned.
|
| + // Only used if the SuggestionsService is built with a mocks. Not owned.
|
| MockSuggestionsStore* mock_suggestions_store_;
|
| + MockBlacklistStore* mock_blacklist_store_;
|
|
|
| private:
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| @@ -240,7 +250,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataRequestError) {
|
| EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
|
| kFakeBlacklistSuffix);
|
| scoped_ptr<SuggestionsService> suggestions_service(
|
| - CreateSuggestionsServiceWithMockStore());
|
| + CreateSuggestionsServiceWithMocks());
|
| EXPECT_TRUE(suggestions_service != NULL);
|
|
|
| // Fake a request error.
|
| @@ -270,7 +280,7 @@ TEST_F(SuggestionsServiceTest, FetchSuggestionsDataResponseNotOK) {
|
| EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
|
| kFakeBlacklistSuffix);
|
| scoped_ptr<SuggestionsService> suggestions_service(
|
| - CreateSuggestionsServiceWithMockStore());
|
| + CreateSuggestionsServiceWithMocks());
|
| EXPECT_TRUE(suggestions_service != NULL);
|
|
|
| // Response code != 200.
|
| @@ -299,7 +309,7 @@ TEST_F(SuggestionsServiceTest, BlacklistURL) {
|
| EnableFieldTrial(kFakeSuggestionsURL, kFakeSuggestionsSuffix,
|
| kFakeBlacklistSuffix);
|
| scoped_ptr<SuggestionsService> suggestions_service(
|
| - CreateSuggestionsServiceWithMockStore());
|
| + CreateSuggestionsServiceWithMocks());
|
| EXPECT_TRUE(suggestions_service != NULL);
|
|
|
| std::string expected_url(kFakeSuggestionsURL);
|
|
|