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

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

Issue 11414303: Make Google Search autocomplete provider cursor aware. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/autocomplete/autocomplete_match.h" 7 #include "chrome/browser/autocomplete/autocomplete_match.h"
8 #include "chrome/browser/autocomplete/keyword_provider.h" 8 #include "chrome/browser/autocomplete/keyword_provider.h"
9 #include "chrome/browser/search_engines/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 kw_provider_ = NULL; 58 kw_provider_ = NULL;
59 } 59 }
60 60
61 template<class ResultType> 61 template<class ResultType>
62 void KeywordProviderTest::RunTest( 62 void KeywordProviderTest::RunTest(
63 test_data<ResultType>* keyword_cases, 63 test_data<ResultType>* keyword_cases,
64 int num_cases, 64 int num_cases,
65 ResultType AutocompleteMatch::* member) { 65 ResultType AutocompleteMatch::* member) {
66 ACMatches matches; 66 ACMatches matches;
67 for (int i = 0; i < num_cases; ++i) { 67 for (int i = 0; i < num_cases; ++i) {
68 AutocompleteInput input(keyword_cases[i].input, string16(), true, 68 AutocompleteInput input(keyword_cases[i].input, string16::npos, string16(),
69 false, true, AutocompleteInput::ALL_MATCHES); 69 true, false, true, AutocompleteInput::ALL_MATCHES);
70 kw_provider_->Start(input, false); 70 kw_provider_->Start(input, false);
71 EXPECT_TRUE(kw_provider_->done()); 71 EXPECT_TRUE(kw_provider_->done());
72 matches = kw_provider_->matches(); 72 matches = kw_provider_->matches();
73 EXPECT_EQ(keyword_cases[i].num_results, matches.size()) << 73 EXPECT_EQ(keyword_cases[i].num_results, matches.size()) <<
74 ASCIIToUTF16("Input was: ") + keyword_cases[i].input; 74 ASCIIToUTF16("Input was: ") + keyword_cases[i].input;
75 if (matches.size() == keyword_cases[i].num_results) { 75 if (matches.size() == keyword_cases[i].num_results) {
76 for (size_t j = 0; j < keyword_cases[i].num_results; ++j) { 76 for (size_t j = 0; j < keyword_cases[i].num_results; ++j) {
77 EXPECT_EQ(keyword_cases[i].output[j], matches[j].*member); 77 EXPECT_EQ(keyword_cases[i].output[j], matches[j].*member);
78 } 78 }
79 } 79 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 218
219 TEST_F(KeywordProviderTest, GetKeywordForInput) { 219 TEST_F(KeywordProviderTest, GetKeywordForInput) {
220 EXPECT_EQ(ASCIIToUTF16("aa"), 220 EXPECT_EQ(ASCIIToUTF16("aa"),
221 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa"))); 221 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa")));
222 EXPECT_EQ(string16(), 222 EXPECT_EQ(string16(),
223 kw_provider_->GetKeywordForText(ASCIIToUTF16("aafoo"))); 223 kw_provider_->GetKeywordForText(ASCIIToUTF16("aafoo")));
224 EXPECT_EQ(string16(), 224 EXPECT_EQ(string16(),
225 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa foo"))); 225 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa foo")));
226 } 226 }
227
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698