Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/history_url_provider.h" | 5 #include "components/omnibox/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 ChromeAutocompleteSchemeClassifier(profile_.get())); | 314 ChromeAutocompleteSchemeClassifier(profile_.get())); |
| 315 *identified_input_type = input.type(); | 315 *identified_input_type = input.type(); |
| 316 autocomplete_->Start(input, false); | 316 autocomplete_->Start(input, false); |
| 317 if (!autocomplete_->done()) | 317 if (!autocomplete_->done()) |
| 318 base::MessageLoop::current()->Run(); | 318 base::MessageLoop::current()->Run(); |
| 319 | 319 |
| 320 matches_ = autocomplete_->matches(); | 320 matches_ = autocomplete_->matches(); |
| 321 if (sort_matches_) { | 321 if (sort_matches_) { |
| 322 TemplateURLService* service = | 322 TemplateURLService* service = |
| 323 TemplateURLServiceFactory::GetForProfile(profile_.get()); | 323 TemplateURLServiceFactory::GetForProfile(profile_.get()); |
| 324 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) | 324 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) { |
| 325 i->ComputeStrippedDestinationURL(service); | 325 i->ComputeStrippedDestinationURL( |
| 326 input, client_.get()->GetAcceptLanguages(), service); | |
|
Peter Kasting
2015/06/29 05:04:58
No need for .get() when doing ->.
Mark P
2015/06/30 04:23:16
Done.
| |
| 327 } | |
| 326 AutocompleteResult::DedupMatchesByDestination( | 328 AutocompleteResult::DedupMatchesByDestination( |
| 327 input.current_page_classification(), false, &matches_); | 329 input.current_page_classification(), false, &matches_); |
| 328 std::sort(matches_.begin(), matches_.end(), | 330 std::sort(matches_.begin(), matches_.end(), |
| 329 &AutocompleteMatch::MoreRelevant); | 331 &AutocompleteMatch::MoreRelevant); |
| 330 } | 332 } |
| 331 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text | 333 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text |
| 332 << "\nTLD: \"" << desired_tld << "\""; | 334 << "\nTLD: \"" << desired_tld << "\""; |
| 333 for (size_t i = 0; i < num_results; ++i) { | 335 for (size_t i = 0; i < num_results; ++i) { |
| 334 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); | 336 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); |
| 335 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, | 337 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1058 // Test the experiment (scoring enabled). | 1060 // Test the experiment (scoring enabled). |
| 1059 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1061 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
| 1060 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1062 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
| 1061 std::string(), false, output, max_matches)); | 1063 std::string(), false, output, max_matches)); |
| 1062 for (int j = 0; j < max_matches; ++j) { | 1064 for (int j = 0; j < max_matches; ++j) { |
| 1063 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1065 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
| 1064 matches_[j].relevance); | 1066 matches_[j].relevance); |
| 1065 } | 1067 } |
| 1066 } | 1068 } |
| 1067 } | 1069 } |
| OLD | NEW |