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

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

Issue 836213002: Assume all providers may give zero suggest responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation issue in athena Created 5 years, 11 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 "chrome/browser/autocomplete/history_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::vector<std::string> expected_urls, 285 std::vector<std::string> expected_urls,
286 bool can_inline_top_result, 286 bool can_inline_top_result,
287 base::string16 expected_fill_into_edit, 287 base::string16 expected_fill_into_edit,
288 base::string16 expected_autocompletion) { 288 base::string16 expected_autocompletion) {
289 SCOPED_TRACE(text); // Minimal hint to query being run. 289 SCOPED_TRACE(text); // Minimal hint to query being run.
290 base::MessageLoop::current()->RunUntilIdle(); 290 base::MessageLoop::current()->RunUntilIdle();
291 AutocompleteInput input(text, cursor_position, std::string(), GURL(), 291 AutocompleteInput input(text, cursor_position, std::string(), GURL(),
292 metrics::OmniboxEventProto::INVALID_SPEC, 292 metrics::OmniboxEventProto::INVALID_SPEC,
293 prevent_inline_autocomplete, false, true, true, 293 prevent_inline_autocomplete, false, true, true,
294 ChromeAutocompleteSchemeClassifier(profile_.get())); 294 ChromeAutocompleteSchemeClassifier(profile_.get()));
295 provider_->Start(input, false); 295 provider_->Start(input, false, false);
296 EXPECT_TRUE(provider_->done()); 296 EXPECT_TRUE(provider_->done());
297 297
298 ac_matches_ = provider_->matches(); 298 ac_matches_ = provider_->matches();
299 299
300 // We should have gotten back at most AutocompleteProvider::kMaxMatches. 300 // We should have gotten back at most AutocompleteProvider::kMaxMatches.
301 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); 301 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches);
302 302
303 // If the number of expected and actual matches aren't equal then we need 303 // If the number of expected and actual matches aren't equal then we need
304 // test no further, but let's do anyway so that we know which URLs failed. 304 // test no further, but let's do anyway so that we know which URLs failed.
305 EXPECT_EQ(expected_urls.size(), ac_matches_.size()); 305 EXPECT_EQ(expected_urls.size(), ac_matches_.size());
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ASCIIToUTF16("anotherengine.com/?q=thequery"), base::string16()); 707 ASCIIToUTF16("anotherengine.com/?q=thequery"), base::string16());
708 708
709 // A search results page should not be returned when typing the engine URL. 709 // A search results page should not be returned when typing the engine URL.
710 expected_urls.clear(); 710 expected_urls.clear();
711 expected_urls.push_back("http://testsearch.com/"); 711 expected_urls.push_back("http://testsearch.com/");
712 RunTest(ASCIIToUTF16("testsearch"), false, expected_urls, true, 712 RunTest(ASCIIToUTF16("testsearch"), false, expected_urls, true,
713 ASCIIToUTF16("testsearch.com"), 713 ASCIIToUTF16("testsearch.com"),
714 ASCIIToUTF16(".com")); 714 ASCIIToUTF16(".com"));
715 } 715 }
716 716
717 TEST_F(HistoryQuickProviderTest, DoesNotProvideMatchesOnFocus) {
718 AutocompleteInput input(ASCIIToUTF16("popularsite"), base::string16::npos,
719 std::string(), GURL(),
720 metrics::OmniboxEventProto::INVALID_SPEC,
721 false, false, true, true,
722 ChromeAutocompleteSchemeClassifier(profile_.get()));
723 provider_->Start(input, false, true);
724 EXPECT_TRUE(provider_->matches().empty());
725 }
726
717 // HQPOrderingTest ------------------------------------------------------------- 727 // HQPOrderingTest -------------------------------------------------------------
718 728
719 TestURLInfo ordering_test_db[] = { 729 TestURLInfo ordering_test_db[] = {
720 {"http://www.teamliquid.net/tlpd/korean/games/21648_bisu_vs_iris", "", 6, 3, 730 {"http://www.teamliquid.net/tlpd/korean/games/21648_bisu_vs_iris", "", 6, 3,
721 256}, 731 256},
722 {"http://www.amazon.com/", "amazon.com: online shopping for electronics, " 732 {"http://www.amazon.com/", "amazon.com: online shopping for electronics, "
723 "apparel, computers, books, dvds & more", 20, 20, 10}, 733 "apparel, computers, books, dvds & more", 20, 20, 10},
724 {"http://www.teamliquid.net/forum/viewmessage.php?topic_id=52045&" 734 {"http://www.teamliquid.net/forum/viewmessage.php?topic_id=52045&"
725 "currentpage=83", "google images", 6, 6, 0}, 735 "currentpage=83", "google images", 6, 6, 0},
726 {"http://www.tempurpedic.com/", "tempur-pedic", 7, 7, 0}, 736 {"http://www.tempurpedic.com/", "tempur-pedic", 7, 7, 0},
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 785
776 TEST_F(HQPOrderingTest, TEAMatch) { 786 TEST_F(HQPOrderingTest, TEAMatch) {
777 std::vector<std::string> expected_urls; 787 std::vector<std::string> expected_urls;
778 expected_urls.push_back("http://www.teamliquid.net/"); 788 expected_urls.push_back("http://www.teamliquid.net/");
779 expected_urls.push_back("http://www.teamliquid.net/tlpd"); 789 expected_urls.push_back("http://www.teamliquid.net/tlpd");
780 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); 790 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players");
781 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, 791 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true,
782 ASCIIToUTF16("www.teamliquid.net"), 792 ASCIIToUTF16("www.teamliquid.net"),
783 ASCIIToUTF16("mliquid.net")); 793 ASCIIToUTF16("mliquid.net"));
784 } 794 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.cc ('k') | chrome/browser/autocomplete/history_url_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698