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.
5 #ifndef COMPONENTS_OMNIBOX_BROWSER_MOCK_AUTOCOMPLETE_PROVIDER_CLIENT_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_MOCK_AUTOCOMPLETE_PROVIDER_CLIENT_H_
10 #include "components/omnibox/browser/autocomplete_provider_client.h"
11 #include "components/omnibox/browser/autocomplete_scheme_classifier.h"
12 #include "components/search_engines/search_terms_data.h"
13 #include "components/search_engines/template_url_service.h"
14 #include "testing/gmock/include/gmock/gmock.h"
16 struct AutocompleteMatch
;
18 class MockAutocompleteProviderClient
: public AutocompleteProviderClient
{
20 MockAutocompleteProviderClient();
21 ~MockAutocompleteProviderClient();
23 // AutocompleteProviderClient:
24 MOCK_METHOD0(GetRequestContext
, net::URLRequestContextGetter
*());
25 MOCK_METHOD0(GetPrefs
, PrefService
*());
26 MOCK_CONST_METHOD0(GetSchemeClassifier
,
27 const AutocompleteSchemeClassifier
&());
28 MOCK_METHOD0(GetAutocompleteClassifier
, AutocompleteClassifier
*());
29 MOCK_METHOD0(GetHistoryService
, history::HistoryService
*());
31 // Can't mock scoped_refptr :\.
32 scoped_refptr
<history::TopSites
> GetTopSites() override
{ return nullptr; }
34 MOCK_METHOD0(GetBookmarkModel
, bookmarks::BookmarkModel
*());
35 MOCK_METHOD0(GetInMemoryDatabase
, history::URLDatabase
*());
36 MOCK_METHOD0(GetInMemoryURLIndex
, InMemoryURLIndex
*());
38 TemplateURLService
* GetTemplateURLService() override
{
39 return template_url_service_
.get();
41 const TemplateURLService
* GetTemplateURLService() const override
{
42 return template_url_service_
.get();
44 scoped_ptr
<KeywordExtensionsDelegate
> GetKeywordExtensionsDelegate(
45 KeywordProvider
* keyword_provider
) override
{
49 MOCK_CONST_METHOD0(GetSearchTermsData
, const SearchTermsData
&());
51 // Can't mock scoped_refptr :\.
52 scoped_refptr
<ShortcutsBackend
> GetShortcutsBackend() override
{
55 scoped_refptr
<ShortcutsBackend
> GetShortcutsBackendIfExists() override
{
59 MOCK_CONST_METHOD0(GetAcceptLanguages
, std::string());
60 MOCK_METHOD0(GetEmbedderRepresentationOfAboutScheme
, std::string());
61 MOCK_METHOD0(GetBuiltinURLs
, std::vector
<base::string16
>());
62 MOCK_METHOD0(GetBuiltinsToProvideAsUserTypes
, std::vector
<base::string16
>());
63 MOCK_CONST_METHOD0(IsOffTheRecord
, bool());
64 MOCK_CONST_METHOD0(SearchSuggestEnabled
, bool());
65 MOCK_CONST_METHOD0(BookmarkBarIsVisible
, bool());
66 MOCK_CONST_METHOD0(TabSyncEnabledAndUnencrypted
, bool());
69 void(const base::string16
& text
,
71 bool allow_exact_keyword_match
,
72 metrics::OmniboxEventProto::PageClassification page_classification
,
73 AutocompleteMatch
* match
,
74 GURL
* alternate_nav_url
));
75 MOCK_METHOD2(DeleteMatchingURLsForKeywordFromHistory
,
76 void(history::KeywordID keyword_id
, const base::string16
& term
));
77 MOCK_METHOD1(PrefetchImage
, void(const GURL
& url
));
79 void set_template_url_service(scoped_ptr
<TemplateURLService
> service
) {
80 template_url_service_
= service
.Pass();
84 scoped_ptr
<TemplateURLService
> template_url_service_
;
86 DISALLOW_COPY_AND_ASSIGN(MockAutocompleteProviderClient
);
89 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_PROVIDER_CLIENT_H_