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

Side by Side Diff: chrome/browser/autocomplete/builtin_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/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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::npos, string16(), 55 AutocompleteInput input(builtin_cases[i].input, string16::npos, string16(),
56 true, false, true, AutocompleteInput::ALL_MATCHES); 56 GURL(), true, false, true,
57 AutocompleteInput::ALL_MATCHES);
57 builtin_provider_->Start(input, false); 58 builtin_provider_->Start(input, false);
58 EXPECT_TRUE(builtin_provider_->done()); 59 EXPECT_TRUE(builtin_provider_->done());
59 matches = builtin_provider_->matches(); 60 matches = builtin_provider_->matches();
60 EXPECT_EQ(builtin_cases[i].num_results, matches.size()) << 61 EXPECT_EQ(builtin_cases[i].num_results, matches.size()) <<
61 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; 62 ASCIIToUTF16("Input was: ") << builtin_cases[i].input;
62 if (matches.size() == builtin_cases[i].num_results) { 63 if (matches.size() == builtin_cases[i].num_results) {
63 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) { 64 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) {
64 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) << 65 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) <<
65 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; 66 ASCIIToUTF16("Input was: ") << builtin_cases[i].input;
66 } 67 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 {kSettings + kPage1.substr(0, 2), 1, {kURL1}}, 205 {kSettings + kPage1.substr(0, 2), 1, {kURL1}},
205 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}}, 206 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}},
206 {kSettings + kPage1, 1, {kURL1}}, 207 {kSettings + kPage1, 1, {kURL1}},
207 {kSettings + kPage2, 1, {kURL2}}, 208 {kSettings + kPage2, 1, {kURL2}},
208 }; 209 };
209 210
210 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases), 211 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases),
211 &AutocompleteMatch::destination_url); 212 &AutocompleteMatch::destination_url);
212 } 213 }
213 #endif 214 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698