| 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 "chrome/browser/autocomplete/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 *identified_input_type = input.type(); | 311 *identified_input_type = input.type(); |
| 312 autocomplete_->Start(input, false, false); | 312 autocomplete_->Start(input, false, false); |
| 313 if (!autocomplete_->done()) | 313 if (!autocomplete_->done()) |
| 314 base::MessageLoop::current()->Run(); | 314 base::MessageLoop::current()->Run(); |
| 315 | 315 |
| 316 matches_ = autocomplete_->matches(); | 316 matches_ = autocomplete_->matches(); |
| 317 if (sort_matches_) { | 317 if (sort_matches_) { |
| 318 TemplateURLService* service = | 318 TemplateURLService* service = |
| 319 TemplateURLServiceFactory::GetForProfile(profile_.get()); | 319 TemplateURLServiceFactory::GetForProfile(profile_.get()); |
| 320 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) | 320 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) |
| 321 i->ComputeStrippedDestinationURL(service); | 321 i->ComputeStrippedDestinationURL(input, service); |
| 322 AutocompleteResult::DedupMatchesByDestination( | 322 AutocompleteResult::DedupMatchesByDestination( |
| 323 input.current_page_classification(), false, &matches_); | 323 input.current_page_classification(), false, &matches_); |
| 324 std::sort(matches_.begin(), matches_.end(), | 324 std::sort(matches_.begin(), matches_.end(), |
| 325 &AutocompleteMatch::MoreRelevant); | 325 &AutocompleteMatch::MoreRelevant); |
| 326 } | 326 } |
| 327 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text | 327 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text |
| 328 << "\nTLD: \"" << desired_tld << "\""; | 328 << "\nTLD: \"" << desired_tld << "\""; |
| 329 for (size_t i = 0; i < num_results; ++i) { | 329 for (size_t i = 0; i < num_results; ++i) { |
| 330 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); | 330 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); |
| 331 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, | 331 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 // Test the experiment (scoring enabled). | 1059 // Test the experiment (scoring enabled). |
| 1060 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1060 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
| 1061 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1061 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
| 1062 std::string(), false, output, max_matches)); | 1062 std::string(), false, output, max_matches)); |
| 1063 for (int j = 0; j < max_matches; ++j) { | 1063 for (int j = 0; j < max_matches; ++j) { |
| 1064 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1064 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
| 1065 matches_[j].relevance); | 1065 matches_[j].relevance); |
| 1066 } | 1066 } |
| 1067 } | 1067 } |
| 1068 } | 1068 } |
| OLD | NEW |