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

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

Issue 6731036: Enabled pressing TAB to cycle through the Omnibox results. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const std::string* expected_urls, 225 const std::string* expected_urls,
226 size_t num_results) { 226 size_t num_results) {
227 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete, 227 AutocompleteInput input(text, desired_tld, prevent_inline_autocomplete,
228 false, true, AutocompleteInput::ALL_MATCHES); 228 false, true, AutocompleteInput::ALL_MATCHES);
229 autocomplete_->Start(input, false); 229 autocomplete_->Start(input, false);
230 if (!autocomplete_->done()) 230 if (!autocomplete_->done())
231 MessageLoop::current()->Run(); 231 MessageLoop::current()->Run();
232 232
233 matches_ = autocomplete_->matches(); 233 matches_ = autocomplete_->matches();
234 if (sort_matches_) { 234 if (sort_matches_) {
235 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i)
236 i->ComputeStrippedDestinationURL();
235 std::sort(matches_.begin(), matches_.end(), 237 std::sort(matches_.begin(), matches_.end(),
236 &AutocompleteMatch::DestinationSortFunc); 238 &AutocompleteMatch::DestinationSortFunc);
237 matches_.erase(std::unique(matches_.begin(), matches_.end(), 239 matches_.erase(std::unique(matches_.begin(), matches_.end(),
238 &AutocompleteMatch::DestinationsEqual), 240 &AutocompleteMatch::DestinationsEqual),
239 matches_.end()); 241 matches_.end());
240 std::sort(matches_.begin(), matches_.end(), 242 std::sort(matches_.begin(), matches_.end(),
241 &AutocompleteMatch::MoreRelevant); 243 &AutocompleteMatch::MoreRelevant);
242 } 244 }
243 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text 245 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text
244 << "\nTLD: \"" << desired_tld << "\""; 246 << "\nTLD: \"" << desired_tld << "\"";
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 "\\@st" 662 "\\@st"
661 }; 663 };
662 for (size_t i = 0; i < arraysize(test_cases); ++i) { 664 for (size_t i = 0; i < arraysize(test_cases); ++i) {
663 AutocompleteInput input(ASCIIToUTF16(test_cases[i]), string16(), false, 665 AutocompleteInput input(ASCIIToUTF16(test_cases[i]), string16(), false,
664 false, true, AutocompleteInput::ALL_MATCHES); 666 false, true, AutocompleteInput::ALL_MATCHES);
665 autocomplete_->Start(input, false); 667 autocomplete_->Start(input, false);
666 if (!autocomplete_->done()) 668 if (!autocomplete_->done())
667 MessageLoop::current()->Run(); 669 MessageLoop::current()->Run();
668 } 670 }
669 } 671 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_unittest.cc ('k') | chrome/browser/autocomplete/keyword_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698