OLD | NEW |
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 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3411 | 3411 |
3412 // Without scored results, no answers will be retrieved. | 3412 // Without scored results, no answers will be retrieved. |
3413 AnswersQueryData answer = provider_->FindAnswersPrefetchData(); | 3413 AnswersQueryData answer = provider_->FindAnswersPrefetchData(); |
3414 EXPECT_TRUE(answer.full_query_text.empty()); | 3414 EXPECT_TRUE(answer.full_query_text.empty()); |
3415 EXPECT_TRUE(answer.query_type.empty()); | 3415 EXPECT_TRUE(answer.query_type.empty()); |
3416 | 3416 |
3417 // Inject a scored result, which will trigger answer retrieval. | 3417 // Inject a scored result, which will trigger answer retrieval. |
3418 base::string16 query = base::ASCIIToUTF16("weather los angeles"); | 3418 base::string16 query = base::ASCIIToUTF16("weather los angeles"); |
3419 SearchSuggestionParser::SuggestResult suggest_result( | 3419 SearchSuggestionParser::SuggestResult suggest_result( |
3420 query, AutocompleteMatchType::SEARCH_HISTORY, query, base::string16(), | 3420 query, AutocompleteMatchType::SEARCH_HISTORY, query, base::string16(), |
3421 base::string16(), base::string16(), base::string16(), std::string(), | 3421 base::string16(), base::string16(), base::string16(), nullptr, |
3422 std::string(), false, 1200, false, false, query); | 3422 std::string(), std::string(), false, 1200, false, false, query); |
3423 QueryForInput(ASCIIToUTF16("weather l"), false, false); | 3423 QueryForInput(ASCIIToUTF16("weather l"), false, false); |
3424 provider_->transformed_default_history_results_.push_back(suggest_result); | 3424 provider_->transformed_default_history_results_.push_back(suggest_result); |
3425 answer = provider_->FindAnswersPrefetchData(); | 3425 answer = provider_->FindAnswersPrefetchData(); |
3426 EXPECT_EQ(base::ASCIIToUTF16("weather los angeles"), answer.full_query_text); | 3426 EXPECT_EQ(base::ASCIIToUTF16("weather los angeles"), answer.full_query_text); |
3427 EXPECT_EQ(base::ASCIIToUTF16("2334"), answer.query_type); | 3427 EXPECT_EQ(base::ASCIIToUTF16("2334"), answer.query_type); |
3428 } | 3428 } |
3429 | 3429 |
3430 TEST_F(SearchProviderTest, RemoveExtraAnswers) { | 3430 TEST_F(SearchProviderTest, RemoveExtraAnswers) { |
3431 ACMatches matches; | 3431 ACMatches matches; |
3432 AutocompleteMatch match1, match2, match3, match4, match5; | 3432 AutocompleteMatch match1, match2, match3, match4, match5; |
(...skipping 15 matching lines...) Expand all Loading... |
3448 EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type); | 3448 EXPECT_EQ(base::ASCIIToUTF16("42"), matches[0].answer_type); |
3449 EXPECT_TRUE(matches[1].answer_contents.empty()); | 3449 EXPECT_TRUE(matches[1].answer_contents.empty()); |
3450 EXPECT_TRUE(matches[1].answer_type.empty()); | 3450 EXPECT_TRUE(matches[1].answer_type.empty()); |
3451 EXPECT_TRUE(matches[2].answer_contents.empty()); | 3451 EXPECT_TRUE(matches[2].answer_contents.empty()); |
3452 EXPECT_TRUE(matches[2].answer_type.empty()); | 3452 EXPECT_TRUE(matches[2].answer_type.empty()); |
3453 EXPECT_TRUE(matches[3].answer_contents.empty()); | 3453 EXPECT_TRUE(matches[3].answer_contents.empty()); |
3454 EXPECT_TRUE(matches[3].answer_type.empty()); | 3454 EXPECT_TRUE(matches[3].answer_type.empty()); |
3455 EXPECT_TRUE(matches[4].answer_contents.empty()); | 3455 EXPECT_TRUE(matches[4].answer_contents.empty()); |
3456 EXPECT_TRUE(matches[4].answer_type.empty()); | 3456 EXPECT_TRUE(matches[4].answer_type.empty()); |
3457 } | 3457 } |
OLD | NEW |