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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider_unittest.cc

Issue 11198074: Initial implementation of dedupping search provider's URLs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add a missing include. Created 8 years, 1 month 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 | Annotate | Revision Log
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 "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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 size_t num_results) { 239 size_t num_results) {
240 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete, 240 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete,
241 false, true, AutocompleteInput::ALL_MATCHES); 241 false, true, AutocompleteInput::ALL_MATCHES);
242 autocomplete_->Start(input, false); 242 autocomplete_->Start(input, false);
243 if (!autocomplete_->done()) 243 if (!autocomplete_->done())
244 MessageLoop::current()->Run(); 244 MessageLoop::current()->Run();
245 245
246 matches_ = autocomplete_->matches(); 246 matches_ = autocomplete_->matches();
247 if (sort_matches_) { 247 if (sort_matches_) {
248 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) 248 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i)
249 i->ComputeStrippedDestinationURL(); 249 i->ComputeStrippedDestinationURL(profile_.get());
250 std::sort(matches_.begin(), matches_.end(), 250 std::sort(matches_.begin(), matches_.end(),
251 &AutocompleteMatch::DestinationSortFunc); 251 &AutocompleteMatch::DestinationSortFunc);
252 matches_.erase(std::unique(matches_.begin(), matches_.end(), 252 matches_.erase(std::unique(matches_.begin(), matches_.end(),
253 &AutocompleteMatch::DestinationsEqual), 253 &AutocompleteMatch::DestinationsEqual),
254 matches_.end()); 254 matches_.end());
255 std::sort(matches_.begin(), matches_.end(), 255 std::sort(matches_.begin(), matches_.end(),
256 &AutocompleteMatch::MoreRelevant); 256 &AutocompleteMatch::MoreRelevant);
257 } 257 }
258 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text 258 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text
259 << "\nTLD: \"" << desired_tld << "\""; 259 << "\nTLD: \"" << desired_tld << "\"";
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 "\\@st" 703 "\\@st"
704 }; 704 };
705 for (size_t i = 0; i < arraysize(test_cases); ++i) { 705 for (size_t i = 0; i < arraysize(test_cases); ++i) {
706 AutocompleteInput input(ASCIIToUTF16(test_cases[i]), string16(), false, 706 AutocompleteInput input(ASCIIToUTF16(test_cases[i]), string16(), false,
707 false, true, AutocompleteInput::ALL_MATCHES); 707 false, true, AutocompleteInput::ALL_MATCHES);
708 autocomplete_->Start(input, false); 708 autocomplete_->Start(input, false);
709 if (!autocomplete_->done()) 709 if (!autocomplete_->done())
710 MessageLoop::current()->Run(); 710 MessageLoop::current()->Run();
711 } 711 }
712 } 712 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_result_unittest.cc ('k') | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698