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

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

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revise test cases to be correct Created 5 years, 5 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/history_url_provider.h" 5 #include "components/omnibox/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 *identified_input_type = input.type(); 315 *identified_input_type = input.type();
316 autocomplete_->Start(input, false); 316 autocomplete_->Start(input, false);
317 if (!autocomplete_->done()) 317 if (!autocomplete_->done())
318 base::MessageLoop::current()->Run(); 318 base::MessageLoop::current()->Run();
319 319
320 matches_ = autocomplete_->matches(); 320 matches_ = autocomplete_->matches();
321 if (sort_matches_) { 321 if (sort_matches_) {
322 TemplateURLService* service = 322 TemplateURLService* service =
323 TemplateURLServiceFactory::GetForProfile(profile_.get()); 323 TemplateURLServiceFactory::GetForProfile(profile_.get());
324 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) 324 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i)
325 i->ComputeStrippedDestinationURL(service); 325 i->ComputeStrippedDestinationURL(input, service);
326 AutocompleteResult::DedupMatchesByDestination( 326 AutocompleteResult::DedupMatchesByDestination(
327 input.current_page_classification(), false, &matches_); 327 input.current_page_classification(), false, &matches_);
328 std::sort(matches_.begin(), matches_.end(), 328 std::sort(matches_.begin(), matches_.end(),
329 &AutocompleteMatch::MoreRelevant); 329 &AutocompleteMatch::MoreRelevant);
330 } 330 }
331 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text 331 ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text
332 << "\nTLD: \"" << desired_tld << "\""; 332 << "\nTLD: \"" << desired_tld << "\"";
333 for (size_t i = 0; i < num_results; ++i) { 333 for (size_t i = 0; i < num_results; ++i) {
334 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec()); 334 EXPECT_EQ(expected_urls[i].url, matches_[i].destination_url.spec());
335 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match, 335 EXPECT_EQ(expected_urls[i].allowed_to_be_default_match,
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 // Test the experiment (scoring enabled). 1058 // Test the experiment (scoring enabled).
1059 autocomplete_->scoring_params_.experimental_scoring_enabled = true; 1059 autocomplete_->scoring_params_.experimental_scoring_enabled = true;
1060 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), 1060 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
1061 std::string(), false, output, max_matches)); 1061 std::string(), false, output, max_matches));
1062 for (int j = 0; j < max_matches; ++j) { 1062 for (int j = 0; j < max_matches; ++j) {
1063 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, 1063 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance,
1064 matches_[j].relevance); 1064 matches_[j].relevance);
1065 } 1065 }
1066 } 1066 }
1067 } 1067 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698