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

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

Issue 603683004: [AiS] Remove answer contents from all matches other than the first. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test, respond to comments Created 6 years, 3 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
« no previous file with comments | « no previous file | components/omnibox/search_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 abb7e7041efe79f8a3668d688f80c0355e61723b..ae47d970efa70b154c8cb89df9021f4528a7b955 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -3420,3 +3420,32 @@ TEST_F(SearchProviderTest, AnswersCache) {
provider_->prefetch_data_.full_query_text);
EXPECT_EQ(base::ASCIIToUTF16("2334"), provider_->prefetch_data_.query_type);
}
+
+TEST_F(SearchProviderTest, RemoveExtraAnswers) {
+ ACMatches matches;
+ AutocompleteMatch match1, match2, match3, match4, match5;
+ match1.answer_contents = base::ASCIIToUTF16("the answer");
+ match1.answer_type = base::ASCIIToUTF16("42");
+ match3.answer_contents = base::ASCIIToUTF16("not to play");
+ match3.answer_type = base::ASCIIToUTF16("1983");
+ match5.answer_contents = base::ASCIIToUTF16("a man");
+ match5.answer_type = base::ASCIIToUTF16("423");
+
+ matches.push_back(match1);
+ matches.push_back(match2);
+ matches.push_back(match3);
+ matches.push_back(match4);
+ matches.push_back(match5);
+
+ SearchProvider::RemoveExtraAnswers(&matches);
+ EXPECT_EQ(base::ASCIIToUTF16("the answer"), matches[0].answer_contents);
+ EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type);
+ EXPECT_TRUE(matches[1].answer_contents.empty());
+ EXPECT_TRUE(matches[1].answer_type.empty());
+ EXPECT_TRUE(matches[2].answer_contents.empty());
+ EXPECT_TRUE(matches[2].answer_type.empty());
+ EXPECT_TRUE(matches[3].answer_contents.empty());
+ EXPECT_TRUE(matches[3].answer_type.empty());
+ EXPECT_TRUE(matches[4].answer_contents.empty());
+ EXPECT_TRUE(matches[4].answer_type.empty());
+}
« no previous file with comments | « no previous file | components/omnibox/search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698