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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // results' destination URLs match those provided. |expected_urls| does not 128 // results' destination URLs match those provided. |expected_urls| does not
129 // need to be in sorted order. 129 // need to be in sorted order.
130 void RunTest(const string16 text, 130 void RunTest(const string16 text,
131 std::vector<std::string> expected_urls, 131 std::vector<std::string> expected_urls,
132 bool can_inline_top_result, 132 bool can_inline_top_result,
133 string16 expected_fill_into_edit); 133 string16 expected_fill_into_edit);
134 134
135 // Pass-through functions to simplify our friendship with URLIndexPrivateData. 135 // Pass-through functions to simplify our friendship with URLIndexPrivateData.
136 bool UpdateURL(const history::URLRow& row); 136 bool UpdateURL(const history::URLRow& row);
137 137
138 MessageLoopForUI message_loop_; 138 base::MessageLoopForUI message_loop_;
139 content::TestBrowserThread ui_thread_; 139 content::TestBrowserThread ui_thread_;
140 content::TestBrowserThread file_thread_; 140 content::TestBrowserThread file_thread_;
141 141
142 scoped_ptr<TestingProfile> profile_; 142 scoped_ptr<TestingProfile> profile_;
143 HistoryService* history_service_; 143 HistoryService* history_service_;
144 144
145 ACMatches ac_matches_; // The resulting matches after running RunTest. 145 ACMatches ac_matches_; // The resulting matches after running RunTest.
146 146
147 scoped_refptr<HistoryQuickProvider> provider_; 147 scoped_refptr<HistoryQuickProvider> provider_;
148 }; 148 };
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 EXPECT_EQ(1U, matches_.erase(expected)) 221 EXPECT_EQ(1U, matches_.erase(expected))
222 << "Results did not contain '" << expected << "' but should have."; 222 << "Results did not contain '" << expected << "' but should have.";
223 } 223 }
224 224
225 225
226 void HistoryQuickProviderTest::RunTest(const string16 text, 226 void HistoryQuickProviderTest::RunTest(const string16 text,
227 std::vector<std::string> expected_urls, 227 std::vector<std::string> expected_urls,
228 bool can_inline_top_result, 228 bool can_inline_top_result,
229 string16 expected_fill_into_edit) { 229 string16 expected_fill_into_edit) {
230 SCOPED_TRACE(text); // Minimal hint to query being run. 230 SCOPED_TRACE(text); // Minimal hint to query being run.
231 MessageLoop::current()->RunUntilIdle(); 231 base::MessageLoop::current()->RunUntilIdle();
232 AutocompleteInput input(text, string16::npos, string16(), GURL(),false, false, 232 AutocompleteInput input(text, string16::npos, string16(), GURL(),false, false,
233 true, AutocompleteInput::ALL_MATCHES); 233 true, AutocompleteInput::ALL_MATCHES);
234 provider_->Start(input, false); 234 provider_->Start(input, false);
235 EXPECT_TRUE(provider_->done()); 235 EXPECT_TRUE(provider_->done());
236 236
237 ac_matches_ = provider_->matches(); 237 ac_matches_ = provider_->matches();
238 238
239 // We should have gotten back at most AutocompleteProvider::kMaxMatches. 239 // We should have gotten back at most AutocompleteProvider::kMaxMatches.
240 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); 240 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches);
241 241
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 615 }
616 616
617 TEST_F(HQPOrderingTest, TEAMatch) { 617 TEST_F(HQPOrderingTest, TEAMatch) {
618 std::vector<std::string> expected_urls; 618 std::vector<std::string> expected_urls;
619 expected_urls.push_back("http://www.teamliquid.net/"); 619 expected_urls.push_back("http://www.teamliquid.net/");
620 expected_urls.push_back("http://www.teamliquid.net/tlpd"); 620 expected_urls.push_back("http://www.teamliquid.net/tlpd");
621 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); 621 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players");
622 RunTest(ASCIIToUTF16("tea"), expected_urls, true, 622 RunTest(ASCIIToUTF16("tea"), expected_urls, true,
623 ASCIIToUTF16("www.teamliquid.net")); 623 ASCIIToUTF16("www.teamliquid.net"));
624 } 624 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_contents_provider_unittest.cc ('k') | chrome/browser/autocomplete/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698