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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/omnibox/search_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/search_provider.h" 5 #include "components/omnibox/search_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after
3413 AutocompleteInput input(base::ASCIIToUTF16("weather l"), 3413 AutocompleteInput input(base::ASCIIToUTF16("weather l"),
3414 base::string16::npos, base::string16(), GURL(), 3414 base::string16::npos, base::string16(), GURL(),
3415 metrics::OmniboxEventProto::INVALID_SPEC, false, 3415 metrics::OmniboxEventProto::INVALID_SPEC, false,
3416 false, true, true, 3416 false, true, true,
3417 ChromeAutocompleteSchemeClassifier(&profile_)); 3417 ChromeAutocompleteSchemeClassifier(&profile_));
3418 provider_->DoAnswersQuery(input); 3418 provider_->DoAnswersQuery(input);
3419 EXPECT_EQ(base::ASCIIToUTF16("weather los angeles"), 3419 EXPECT_EQ(base::ASCIIToUTF16("weather los angeles"),
3420 provider_->prefetch_data_.full_query_text); 3420 provider_->prefetch_data_.full_query_text);
3421 EXPECT_EQ(base::ASCIIToUTF16("2334"), provider_->prefetch_data_.query_type); 3421 EXPECT_EQ(base::ASCIIToUTF16("2334"), provider_->prefetch_data_.query_type);
3422 } 3422 }
3423
3424 TEST_F(SearchProviderTest, RemoveExtraAnswers) {
3425 ACMatches matches;
3426 AutocompleteMatch match1, match2, match3, match4, match5;
3427 match1.answer_contents = base::ASCIIToUTF16("the answer");
3428 match1.answer_type = base::ASCIIToUTF16("42");
3429 match3.answer_contents = base::ASCIIToUTF16("not to play");
3430 match3.answer_type = base::ASCIIToUTF16("1983");
3431 match5.answer_contents = base::ASCIIToUTF16("a man");
3432 match5.answer_type = base::ASCIIToUTF16("423");
3433
3434 matches.push_back(match1);
3435 matches.push_back(match2);
3436 matches.push_back(match3);
3437 matches.push_back(match4);
3438 matches.push_back(match5);
3439
3440 SearchProvider::RemoveExtraAnswers(&matches);
3441 EXPECT_EQ(base::ASCIIToUTF16("the answer"), matches[0].answer_contents);
3442 EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type);
3443 EXPECT_TRUE(matches[1].answer_contents.empty());
3444 EXPECT_TRUE(matches[1].answer_type.empty());
3445 EXPECT_TRUE(matches[2].answer_contents.empty());
3446 EXPECT_TRUE(matches[2].answer_type.empty());
3447 EXPECT_TRUE(matches[3].answer_contents.empty());
3448 EXPECT_TRUE(matches[3].answer_type.empty());
3449 EXPECT_TRUE(matches[4].answer_contents.empty());
3450 EXPECT_TRUE(matches[4].answer_type.empty());
3451 }
OLDNEW
« 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