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

Side by Side Diff: chrome/browser/autocomplete/builtin_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 "chrome/browser/autocomplete/builtin_provider.h" 5 #include "chrome/browser/autocomplete/builtin_provider.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autocomplete/autocomplete_input.h" 9 #include "chrome/browser/autocomplete/autocomplete_input.h"
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void BuiltinProviderTest::TearDown() { 45 void BuiltinProviderTest::TearDown() {
46 builtin_provider_ = NULL; 46 builtin_provider_ = NULL;
47 } 47 }
48 48
49 template<class ResultType> 49 template<class ResultType>
50 void BuiltinProviderTest::RunTest(test_data<ResultType>* builtin_cases, 50 void BuiltinProviderTest::RunTest(test_data<ResultType>* builtin_cases,
51 int num_cases, 51 int num_cases,
52 ResultType AutocompleteMatch::* member) { 52 ResultType AutocompleteMatch::* member) {
53 ACMatches matches; 53 ACMatches matches;
54 for (int i = 0; i < num_cases; ++i) { 54 for (int i = 0; i < num_cases; ++i) {
55 AutocompleteInput input(builtin_cases[i].input, string16(), true, 55 AutocompleteInput input(builtin_cases[i].input, string16::npos, string16(),
56 false, true, AutocompleteInput::ALL_MATCHES); 56 true, false, true, AutocompleteInput::ALL_MATCHES);
57 builtin_provider_->Start(input, false); 57 builtin_provider_->Start(input, false);
58 EXPECT_TRUE(builtin_provider_->done()); 58 EXPECT_TRUE(builtin_provider_->done());
59 matches = builtin_provider_->matches(); 59 matches = builtin_provider_->matches();
60 EXPECT_EQ(builtin_cases[i].num_results, matches.size()) << 60 EXPECT_EQ(builtin_cases[i].num_results, matches.size()) <<
61 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; 61 ASCIIToUTF16("Input was: ") << builtin_cases[i].input;
62 if (matches.size() == builtin_cases[i].num_results) { 62 if (matches.size() == builtin_cases[i].num_results) {
63 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) { 63 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) {
64 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) << 64 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) <<
65 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; 65 ASCIIToUTF16("Input was: ") << builtin_cases[i].input;
66 } 66 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 {kSettings + kPage1.substr(0, 2), 1, {kURL1}}, 222 {kSettings + kPage1.substr(0, 2), 1, {kURL1}},
223 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}}, 223 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}},
224 {kSettings + kPage1, 1, {kURL1}}, 224 {kSettings + kPage1, 1, {kURL1}},
225 {kSettings + kPage2, 1, {kURL2}}, 225 {kSettings + kPage2, 1, {kURL2}},
226 }; 226 };
227 227
228 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases), 228 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases),
229 &AutocompleteMatch::destination_url); 229 &AutocompleteMatch::destination_url);
230 } 230 }
231 #endif 231 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698