diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 16:37:58 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-23 16:37:58 +0000 |
commit | b547666db3afc16f7749db7a71255fbf4bcb7af4 (patch) | |
tree | 90ac231bc949f0c6ed2db7894bf93b52fe2afae2 /chrome/browser/autocomplete/search_provider.h | |
parent | e98e82ac535ece8199fc0607b337b6cc1767e305 (diff) | |
download | chromium_src-b547666db3afc16f7749db7a71255fbf4bcb7af4.zip chromium_src-b547666db3afc16f7749db7a71255fbf4bcb7af4.tar.gz chromium_src-b547666db3afc16f7749db7a71255fbf4bcb7af4.tar.bz2 |
A basic search provider unit test. This tests asserts a handful of things:
. The default/keyword suggest providers are queried appropriately.
. History results are asked for default/keyword providers.
More assertions can be added over time, but we have to start some
where.
This uncovered one bug in SearchProvider, we were never marking the
provider as properly done.
BUG=3636
TEST=none
Review URL: http://codereview.chromium.org/87062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/search_provider.h')
-rw-r--r-- | chrome/browser/autocomplete/search_provider.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h index 06e0352..6515bc7 100644 --- a/chrome/browser/autocomplete/search_provider.h +++ b/chrome/browser/autocomplete/search_provider.h @@ -48,6 +48,12 @@ class SearchProvider : public AutocompleteProvider, have_suggest_results_(false) { } +#if defined(UNIT_TEST) + static void set_query_suggest_immediately(bool value) { + query_suggest_immediately_ = value; + } +#endif + // AutocompleteProvider virtual void Start(const AutocompleteInput& input, bool minimal_changes); @@ -61,6 +67,12 @@ class SearchProvider : public AutocompleteProvider, const ResponseCookies& cookies, const std::string& data); + // ID used in creating URLFetcher for default provider's suggest results. + static const int kDefaultProviderURLFetcherID; + + // ID used in creating URLFetcher for keyword provider's suggest results. + static const int kKeywordProviderURLFetcherID; + private: // Manages the providers (TemplateURLs) used by SearchProvider. Two providers // may be used: @@ -179,7 +191,8 @@ class SearchProvider : public AutocompleteProvider, // Creates a URLFetcher requesting suggest results for the specified // TemplateURL. Ownership of the returned URLFetchet passes to the caller. - URLFetcher* CreateSuggestFetcher(const TemplateURL& provider, + URLFetcher* CreateSuggestFetcher(int id, + const TemplateURL& provider, const std::wstring& text); // Parses the results from the Suggest server and stores up to kMaxMatches of @@ -252,6 +265,10 @@ class SearchProvider : public AutocompleteProvider, // TODO(kochi): this is duplicate from history_autocomplete static size_t TrimHttpPrefix(std::wstring* url); + // Should we query for suggest results immediately? This is normally false, + // but may be set to true during testing. + static bool query_suggest_immediately_; + // Maintains the TemplateURLs used. Providers providers_; |