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

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

Issue 12623029: Upstreaming mechanism to add query refinement to omnibox searches. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied Peter's comments. Created 7 years, 9 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) 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 << "Results did not contain '" << expected << "' but should have."; 220 << "Results did not contain '" << expected << "' but should have.";
221 } 221 }
222 222
223 223
224 void HistoryQuickProviderTest::RunTest(const string16 text, 224 void HistoryQuickProviderTest::RunTest(const string16 text,
225 std::vector<std::string> expected_urls, 225 std::vector<std::string> expected_urls,
226 bool can_inline_top_result, 226 bool can_inline_top_result,
227 string16 expected_fill_into_edit) { 227 string16 expected_fill_into_edit) {
228 SCOPED_TRACE(text); // Minimal hint to query being run. 228 SCOPED_TRACE(text); // Minimal hint to query being run.
229 MessageLoop::current()->RunUntilIdle(); 229 MessageLoop::current()->RunUntilIdle();
230 AutocompleteInput input(text, string16::npos, string16(), false, false, true, 230 AutocompleteInput input(text, string16::npos, string16(), GURL(),false, false,
231 AutocompleteInput::ALL_MATCHES); 231 true, AutocompleteInput::ALL_MATCHES);
232 provider_->Start(input, false); 232 provider_->Start(input, false);
233 EXPECT_TRUE(provider_->done()); 233 EXPECT_TRUE(provider_->done());
234 234
235 ac_matches_ = provider_->matches(); 235 ac_matches_ = provider_->matches();
236 236
237 // We should have gotten back at most AutocompleteProvider::kMaxMatches. 237 // We should have gotten back at most AutocompleteProvider::kMaxMatches.
238 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); 238 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches);
239 239
240 // If the number of expected and actual matches aren't equal then we need 240 // If the number of expected and actual matches aren't equal then we need
241 // test no further, but let's do anyway so that we know which URLs failed. 241 // test no further, but let's do anyway so that we know which URLs failed.
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 613 }
614 614
615 TEST_F(HQPOrderingTest, TEAMatch) { 615 TEST_F(HQPOrderingTest, TEAMatch) {
616 std::vector<std::string> expected_urls; 616 std::vector<std::string> expected_urls;
617 expected_urls.push_back("http://www.teamliquid.net/"); 617 expected_urls.push_back("http://www.teamliquid.net/");
618 expected_urls.push_back("http://www.teamliquid.net/tlpd"); 618 expected_urls.push_back("http://www.teamliquid.net/tlpd");
619 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); 619 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players");
620 RunTest(ASCIIToUTF16("tea"), expected_urls, true, 620 RunTest(ASCIIToUTF16("tea"), expected_urls, true,
621 ASCIIToUTF16("www.teamliquid.net")); 621 ASCIIToUTF16("www.teamliquid.net"));
622 } 622 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698