Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 10537154: A working implementation of AQS (Assisted Query Stats). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added Autocomplete unit tests. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/search_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 227c163a084100aaad205ad369bd235ed3e48fde..5358b1a7322cf5be6250a4be713373774fd4c077 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -210,8 +210,9 @@ void SearchProviderTest::QueryForInputAndSetWYTMatch(
return;
ASSERT_GE(provider_->matches().size(), 1u);
EXPECT_TRUE(FindMatchWithDestination(GURL(
- default_t_url_->url_ref().ReplaceSearchTerms(text,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), wyt_match));
+ default_t_url_->url_ref().ReplaceSearchTerms(
+ TemplateURLRef::SearchTermsArgs(text))),
+ wyt_match));
}
void SearchProviderTest::TearDown() {
@@ -226,8 +227,8 @@ GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url,
int visit_count) {
HistoryService* history =
profile_.GetHistoryService(Profile::EXPLICIT_ACCESS);
- GURL search(t_url->url_ref().ReplaceSearchTerms(term,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
+ GURL search(t_url->url_ref().ReplaceSearchTerms(
+ TemplateURLRef::SearchTermsArgs(term)));
static base::Time last_added_time;
last_added_time = std::max(base::Time::Now(),
last_added_time + base::TimeDelta::FromMicroseconds(1));
@@ -286,7 +287,7 @@ TEST_F(SearchProviderTest, QueryDefaultProvider) {
// And the URL matches what we expected.
GURL expected_url(default_t_url_->suggestions_url_ref().ReplaceSearchTerms(
- term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
+ TemplateURLRef::SearchTermsArgs(term)));
ASSERT_TRUE(fetcher->GetOriginalURL() == expected_url);
// Tell the SearchProvider the suggest query is done.
@@ -306,8 +307,8 @@ TEST_F(SearchProviderTest, QueryDefaultProvider) {
AutocompleteMatch wyt_match;
EXPECT_TRUE(FindMatchWithDestination(
- GURL(default_t_url_->url_ref().ReplaceSearchTerms(term,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), &wyt_match));
+ GURL(default_t_url_->url_ref().ReplaceSearchTerms(
+ TemplateURLRef::SearchTermsArgs(term))), &wyt_match));
EXPECT_TRUE(wyt_match.description.empty());
// The match for term1 should be more relevant than the what you typed result.
@@ -347,7 +348,7 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) {
// And the URL matches what we expected.
GURL expected_url(keyword_t_url_->suggestions_url_ref().ReplaceSearchTerms(
- term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
+ TemplateURLRef::SearchTermsArgs(term)));
ASSERT_TRUE(keyword_fetcher->GetOriginalURL() == expected_url);
// Tell the SearchProvider the keyword suggest query is done.
@@ -416,8 +417,7 @@ TEST_F(SearchProviderTest, FinalizeInstantQuery) {
// 'foobar'.
EXPECT_EQ(2u, provider_->matches().size());
GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms(
- ASCIIToUTF16("foobar"), TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- string16()));
+ TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar"))));
AutocompleteMatch instant_match;
EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match));
@@ -427,8 +427,9 @@ TEST_F(SearchProviderTest, FinalizeInstantQuery) {
// Make sure the what you typed match has no description.
AutocompleteMatch wyt_match;
EXPECT_TRUE(FindMatchWithDestination(
- GURL(default_t_url_->url_ref().ReplaceSearchTerms(ASCIIToUTF16("foo"),
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())), &wyt_match));
+ GURL(default_t_url_->url_ref().ReplaceSearchTerms(
+ TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foo")))),
+ &wyt_match));
EXPECT_TRUE(wyt_match.description.empty());
// The instant search should be more relevant.
@@ -450,8 +451,7 @@ TEST_F(SearchProviderTest, RememberInstantQuery) {
// 'foobar'.
EXPECT_EQ(2u, provider_->matches().size());
GURL instant_url(default_t_url_->url_ref().ReplaceSearchTerms(
- ASCIIToUTF16("foobar"), TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- string16()));
+ TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("foobar"))));
AutocompleteMatch instant_match;
EXPECT_TRUE(FindMatchWithDestination(instant_url, &instant_match));

Powered by Google App Engine
This is Rietveld 408576698