Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Side by Side Diff: components/omnibox/browser/history_url_provider_unittest.cc

Issue 1877833002: Optimize shortcuts provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on master and minor format fix Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 prevent_inline_autocomplete, false, true, true, false, 325 prevent_inline_autocomplete, false, true, true, false,
326 TestSchemeClassifier()); 326 TestSchemeClassifier());
327 *identified_input_type = input.type(); 327 *identified_input_type = input.type();
328 autocomplete_->Start(input, false); 328 autocomplete_->Start(input, false);
329 if (!autocomplete_->done()) 329 if (!autocomplete_->done())
330 base::MessageLoop::current()->Run(); 330 base::MessageLoop::current()->Run();
331 331
332 matches_ = autocomplete_->matches(); 332 matches_ = autocomplete_->matches();
333 if (sort_matches_) { 333 if (sort_matches_) {
334 TemplateURLService* service = client_->GetTemplateURLService(); 334 TemplateURLService* service = client_->GetTemplateURLService();
335 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) 335 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) {
336 i->ComputeStrippedDestinationURL(input, service); 336 i->ComputeStrippedDestinationURL(input, service);
337 AutocompleteResult::DedupMatchesByDestination( 337 }
338 input.current_page_classification(), false, &matches_); 338 AutocompleteResult::SortAndDedupMatches(input.current_page_classification(),
339 &matches_);
339 std::sort(matches_.begin(), matches_.end(), 340 std::sort(matches_.begin(), matches_.end(),
340 &AutocompleteMatch::MoreRelevant); 341 &AutocompleteMatch::MoreRelevant);
341 } 342 }
342 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text 343 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text
343 << "\nTLD: \"" << desired_tld << "\""; 344 << "\nTLD: \"" << desired_tld << "\"";
344 for (size_t i = 0; i < num_results; ++i) { 345 for (size_t i = 0; i < num_results; ++i) {
345 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); 346 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec());
346 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, 347 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match,
347 matches_[i].allowed_to_be_default_match); 348 matches_[i].allowed_to_be_default_match);
348 } 349 }
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 // the default experimental scoring. 1115 // the default experimental scoring.
1115 autocomplete_->scoring_params_.experimental_scoring_enabled = true; 1116 autocomplete_->scoring_params_.experimental_scoring_enabled = true;
1116 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), 1117 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
1117 std::string(), false, output, max_matches)); 1118 std::string(), false, output, max_matches));
1118 for (int j = 0; j < max_matches; ++j) { 1119 for (int j = 0; j < max_matches; ++j) {
1119 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, 1120 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance,
1120 matches_[j].relevance); 1121 matches_[j].relevance);
1121 } 1122 }
1122 } 1123 }
1123 } 1124 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_result.cc ('k') | components/omnibox/browser/match_compare.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698