summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/search_provider_unittest.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-15 22:56:19 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-15 22:56:19 +0000
commitbdca9beb83417cf7b03f7f42016c2c1718b4148c (patch)
treeb8a3c8216b1e31e11f0cb5a7e5170676d559cc80 /chrome/browser/autocomplete/search_provider_unittest.cc
parentb0a9beade34d92715f55c5756f3c41b2f6fb16da (diff)
downloadchromium_src-bdca9beb83417cf7b03f7f42016c2c1718b4148c.zip
chromium_src-bdca9beb83417cf7b03f7f42016c2c1718b4148c.tar.gz
chromium_src-bdca9beb83417cf7b03f7f42016c2c1718b4148c.tar.bz2
Makes search provider honor inline autocomplete.
BUG=63151 TEST=see bug Review URL: http://codereview.chromium.org/4978002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/search_provider_unittest.cc')
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 7e268d1..6c20d55 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -58,7 +58,8 @@ class SearchProviderTest : public testing::Test,
void RunTillProviderDone();
// Invokes Start on provider_, then runs all pending tasks.
- void QueryForInput(const string16& text);
+ void QueryForInput(const string16& text,
+ bool prevent_inline_autocomplete);
// See description above class for details of these fields.
TemplateURL* default_t_url_;
@@ -162,10 +163,11 @@ void SearchProviderTest::RunTillProviderDone() {
#endif
}
-void SearchProviderTest::QueryForInput(const string16& text) {
+void SearchProviderTest::QueryForInput(const string16& text,
+ bool prevent_inline_autocomplete) {
// Start a query.
AutocompleteInput input(UTF16ToWide(text), std::wstring(),
- false, false, true, false);
+ prevent_inline_autocomplete, false, true, false);
provider_->Start(input, false);
// RunAllPending so that the task scheduled by SearchProvider to create the
@@ -198,7 +200,7 @@ AutocompleteMatch SearchProviderTest::FindMatchWithDestination(
// created for the default provider suggest results.
TEST_F(SearchProviderTest, QueryDefaultProvider) {
string16 term = term1_.substr(0, term1_.size() - 1);
- QueryForInput(term);
+ QueryForInput(term, false);
// Make sure the default providers suggest service was queried.
TestURLFetcher* fetcher = test_factory_.GetFetcherByID(
@@ -226,12 +228,21 @@ TEST_F(SearchProviderTest, QueryDefaultProvider) {
ASSERT_TRUE(!match.destination_url.is_empty());
}
+TEST_F(SearchProviderTest, HonorPreventInlineAutocomplete) {
+ string16 term = term1_.substr(0, term1_.size() - 1);
+ QueryForInput(term, true);
+
+ ASSERT_FALSE(provider_->matches().empty());
+ ASSERT_EQ(AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
+ provider_->matches()[0].type);
+}
+
// Issues a query that matches the registered keyword and makes sure history
// is queried as well as URLFetchers getting created.
TEST_F(SearchProviderTest, QueryKeywordProvider) {
string16 term = keyword_term_.substr(0, keyword_term_.size() - 1);
QueryForInput(WideToUTF16(keyword_t_url_->keyword()) +
- UTF8ToUTF16(" ") + term);
+ UTF8ToUTF16(" ") + term, false);
// Make sure the default providers suggest service was queried.
TestURLFetcher* default_fetcher = test_factory_.GetFetcherByID(
@@ -295,7 +306,7 @@ TEST_F(SearchProviderTest, DontSendPrivateDataToSuggest) {
};
for (size_t i = 0; i < arraysize(inputs); ++i) {
- QueryForInput(ASCIIToUTF16(inputs[i]));
+ QueryForInput(ASCIIToUTF16(inputs[i]), false);
// Make sure the default providers suggest service was not queried.
ASSERT_TRUE(test_factory_.GetFetcherByID(
SearchProvider::kDefaultProviderURLFetcherID) == NULL);