| 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 3516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3527 match1.answer_contents = base::ASCIIToUTF16("m1"); | 3527 match1.answer_contents = base::ASCIIToUTF16("m1"); |
| 3528 match1.answer_type = base::ASCIIToUTF16("2334"); | 3528 match1.answer_type = base::ASCIIToUTF16("2334"); |
| 3529 match1.fill_into_edit = base::ASCIIToUTF16("weather los angeles"); | 3529 match1.fill_into_edit = base::ASCIIToUTF16("weather los angeles"); |
| 3530 | 3530 |
| 3531 AutocompleteMatch non_answer_match1; | 3531 AutocompleteMatch non_answer_match1; |
| 3532 non_answer_match1.fill_into_edit = base::ASCIIToUTF16("weather laguna beach"); | 3532 non_answer_match1.fill_into_edit = base::ASCIIToUTF16("weather laguna beach"); |
| 3533 | 3533 |
| 3534 // Test that an answer in the first slot populates the cache. | 3534 // Test that an answer in the first slot populates the cache. |
| 3535 matches.push_back(match1); | 3535 matches.push_back(match1); |
| 3536 matches.push_back(non_answer_match1); | 3536 matches.push_back(non_answer_match1); |
| 3537 result.AppendMatches(matches); | 3537 result.AppendMatches(AutocompleteInput(), matches); |
| 3538 provider_->RegisterDisplayedAnswers(result); | 3538 provider_->RegisterDisplayedAnswers(result); |
| 3539 ASSERT_FALSE(provider_->answers_cache_.empty()); | 3539 ASSERT_FALSE(provider_->answers_cache_.empty()); |
| 3540 | 3540 |
| 3541 // Without scored results, no answers will be retrieved. | 3541 // Without scored results, no answers will be retrieved. |
| 3542 AnswersQueryData answer = provider_->FindAnswersPrefetchData(); | 3542 AnswersQueryData answer = provider_->FindAnswersPrefetchData(); |
| 3543 EXPECT_TRUE(answer.full_query_text.empty()); | 3543 EXPECT_TRUE(answer.full_query_text.empty()); |
| 3544 EXPECT_TRUE(answer.query_type.empty()); | 3544 EXPECT_TRUE(answer.query_type.empty()); |
| 3545 | 3545 |
| 3546 // Inject a scored result, which will trigger answer retrieval. | 3546 // Inject a scored result, which will trigger answer retrieval. |
| 3547 base::string16 query = base::ASCIIToUTF16("weather los angeles"); | 3547 base::string16 query = base::ASCIIToUTF16("weather los angeles"); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3602 | 3602 |
| 3603 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3603 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
| 3604 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, | 3604 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, |
| 3605 std::string(), GURL(), | 3605 std::string(), GURL(), |
| 3606 metrics::OmniboxEventProto::INVALID_SPEC, false, | 3606 metrics::OmniboxEventProto::INVALID_SPEC, false, |
| 3607 true, true, true, | 3607 true, true, true, |
| 3608 ChromeAutocompleteSchemeClassifier(&profile_)); | 3608 ChromeAutocompleteSchemeClassifier(&profile_)); |
| 3609 provider_->Start(input, false, true); | 3609 provider_->Start(input, false, true); |
| 3610 EXPECT_TRUE(provider_->matches().empty()); | 3610 EXPECT_TRUE(provider_->matches().empty()); |
| 3611 } | 3611 } |
| OLD | NEW |