OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_OMNIBOX_MOCK_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |
| 6 #define COMPONENTS_OMNIBOX_MOCK_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |
| 7 |
| 8 #include "components/omnibox/autocomplete_provider_client.h" |
| 9 #include "components/omnibox/autocomplete_scheme_classifier.h" |
| 10 #include "components/search_engines/search_terms_data.h" |
| 11 #include "components/search_engines/template_url_service.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 |
| 14 struct AutocompleteMatch; |
| 15 |
| 16 class MockAutocompleteProviderClient : public AutocompleteProviderClient { |
| 17 public: |
| 18 MockAutocompleteProviderClient(); |
| 19 ~MockAutocompleteProviderClient(); |
| 20 |
| 21 // AutocompleteProviderClient: |
| 22 MOCK_METHOD0(GetRequestContext, net::URLRequestContextGetter*()); |
| 23 MOCK_METHOD0(GetPrefs, PrefService*()); |
| 24 MOCK_CONST_METHOD0(GetSchemeClassifier, |
| 25 const AutocompleteSchemeClassifier&()); |
| 26 MOCK_METHOD0(GetAutocompleteClassifier, AutocompleteClassifier*()); |
| 27 MOCK_METHOD0(GetHistoryService, history::HistoryService*()); |
| 28 |
| 29 // Can't mock scoped_refptr :\. |
| 30 scoped_refptr<history::TopSites> GetTopSites() override { return nullptr; } |
| 31 |
| 32 MOCK_METHOD0(GetBookmarkModel, bookmarks::BookmarkModel*()); |
| 33 MOCK_METHOD0(GetInMemoryDatabase, history::URLDatabase*()); |
| 34 MOCK_METHOD0(GetInMemoryURLIndex, InMemoryURLIndex*()); |
| 35 |
| 36 TemplateURLService* GetTemplateURLService() override { |
| 37 return template_url_service_.get(); |
| 38 } |
| 39 const TemplateURLService* GetTemplateURLService() const override { |
| 40 return template_url_service_.get(); |
| 41 } |
| 42 scoped_ptr<KeywordExtensionsDelegate> GetKeywordExtensionsDelegate( |
| 43 KeywordProvider* keyword_provider) override { |
| 44 return nullptr; |
| 45 } |
| 46 |
| 47 MOCK_CONST_METHOD0(GetSearchTermsData, const SearchTermsData&()); |
| 48 |
| 49 // Can't mock scoped_refptr :\. |
| 50 scoped_refptr<ShortcutsBackend> GetShortcutsBackend() override { |
| 51 return nullptr; |
| 52 } |
| 53 scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override { |
| 54 return nullptr; |
| 55 } |
| 56 |
| 57 MOCK_CONST_METHOD0(GetAcceptLanguages, std::string()); |
| 58 MOCK_CONST_METHOD0(IsOffTheRecord, bool()); |
| 59 MOCK_CONST_METHOD0(SearchSuggestEnabled, bool()); |
| 60 MOCK_CONST_METHOD0(BookmarkBarIsVisible, bool()); |
| 61 MOCK_CONST_METHOD0(TabSyncEnabledAndUnencrypted, bool()); |
| 62 MOCK_METHOD6( |
| 63 Classify, |
| 64 void(const base::string16& text, |
| 65 bool prefer_keyword, |
| 66 bool allow_exact_keyword_match, |
| 67 metrics::OmniboxEventProto::PageClassification page_classification, |
| 68 AutocompleteMatch* match, |
| 69 GURL* alternate_nav_url)); |
| 70 MOCK_METHOD2(DeleteMatchingURLsForKeywordFromHistory, |
| 71 void(history::KeywordID keyword_id, const base::string16& term)); |
| 72 MOCK_METHOD1(PrefetchImage, void(const GURL& url)); |
| 73 |
| 74 void set_template_url_service(scoped_ptr<TemplateURLService> service) { |
| 75 template_url_service_ = service.Pass(); |
| 76 } |
| 77 |
| 78 private: |
| 79 scoped_ptr<TemplateURLService> template_url_service_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(MockAutocompleteProviderClient); |
| 82 }; |
| 83 |
| 84 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_CLIENT_H_ |
OLD | NEW |