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/browser/history_url_provider.h" | 5 #include "components/omnibox/browser/history_url_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (!autocomplete_->done()) | 333 if (!autocomplete_->done()) |
334 base::MessageLoop::current()->Run(); | 334 base::MessageLoop::current()->Run(); |
335 | 335 |
336 matches_ = autocomplete_->matches(); | 336 matches_ = autocomplete_->matches(); |
337 if (sort_matches_) { | 337 if (sort_matches_) { |
338 TemplateURLService* service = client_->GetTemplateURLService(); | 338 TemplateURLService* service = client_->GetTemplateURLService(); |
339 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) { | 339 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) { |
340 i->ComputeStrippedDestinationURL( | 340 i->ComputeStrippedDestinationURL( |
341 input, client_->GetAcceptLanguages(), service); | 341 input, client_->GetAcceptLanguages(), service); |
342 } | 342 } |
343 AutocompleteResult::DedupMatchesByDestination( | 343 AutocompleteResult::SortAndDedupMatches(input.current_page_classification(), |
344 input.current_page_classification(), false, &matches_); | 344 &matches_); |
345 std::sort(matches_.begin(), matches_.end(), | 345 std::sort(matches_.begin(), matches_.end(), |
346 &AutocompleteMatch::MoreRelevant); | 346 &AutocompleteMatch::MoreRelevant); |
347 } | 347 } |
348 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text | 348 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text |
349 << "\nTLD: \"" << desired_tld << "\""; | 349 << "\nTLD: \"" << desired_tld << "\""; |
350 for (size_t i = 0; i < num_results; ++i) { | 350 for (size_t i = 0; i < num_results; ++i) { |
351 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); | 351 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); |
352 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, | 352 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, |
353 matches_[i].allowed_to_be_default_match); | 353 matches_[i].allowed_to_be_default_match); |
354 } | 354 } |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 // the default experimental scoring. | 1120 // the default experimental scoring. |
1121 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1121 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1122 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1122 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
1123 std::string(), false, output, max_matches)); | 1123 std::string(), false, output, max_matches)); |
1124 for (int j = 0; j < max_matches; ++j) { | 1124 for (int j = 0; j < max_matches; ++j) { |
1125 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1125 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1126 matches_[j].relevance); | 1126 matches_[j].relevance); |
1127 } | 1127 } |
1128 } | 1128 } |
1129 } | 1129 } |
OLD | NEW |