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

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

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverting ifdef'ed constructor Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete.h" 10 #include "chrome/browser/autocomplete/autocomplete.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ASCIIToUTF16("http://a")); 146 ASCIIToUTF16("http://a"));
147 providerA->AddRef(); 147 providerA->AddRef();
148 providers_.push_back(providerA); 148 providers_.push_back(providerA);
149 149
150 TestProvider* providerB = new TestProvider(num_results_per_provider * 2, 150 TestProvider* providerB = new TestProvider(num_results_per_provider * 2,
151 same_destinations ? ASCIIToUTF16("http://a") : ASCIIToUTF16("http://b")); 151 same_destinations ? ASCIIToUTF16("http://a") : ASCIIToUTF16("http://b"));
152 providerB->AddRef(); 152 providerB->AddRef();
153 providers_.push_back(providerB); 153 providers_.push_back(providerB);
154 154
155 // Reset the controller to contain our new providers. 155 // Reset the controller to contain our new providers.
156 AutocompleteController* controller = new AutocompleteController(providers_); 156 AutocompleteController* controller =
157 new AutocompleteController(providers_, &profile_);
157 controller_.reset(controller); 158 controller_.reset(controller);
158 providerA->set_listener(controller); 159 providerA->set_listener(controller);
159 providerB->set_listener(controller); 160 providerB->set_listener(controller);
160 161
161 // The providers don't complete synchronously, so listen for "result updated" 162 // The providers don't complete synchronously, so listen for "result updated"
162 // notifications. 163 // notifications.
163 registrar_.Add(this, 164 registrar_.Add(this,
164 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, 165 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY,
165 NotificationService::AllSources()); 166 NotificationService::AllSources());
166 } 167 }
(...skipping 27 matching lines...) Expand all
194 // Create both a keyword and search provider, and add them in that order. 195 // Create both a keyword and search provider, and add them in that order.
195 // (Order is important; see comments in RunExactKeymatchTest().) 196 // (Order is important; see comments in RunExactKeymatchTest().)
196 AutocompleteProvider* keyword_provider = new KeywordProvider(NULL, 197 AutocompleteProvider* keyword_provider = new KeywordProvider(NULL,
197 &profile_); 198 &profile_);
198 keyword_provider->AddRef(); 199 keyword_provider->AddRef();
199 providers_.push_back(keyword_provider); 200 providers_.push_back(keyword_provider);
200 AutocompleteProvider* search_provider = new SearchProvider(NULL, &profile_); 201 AutocompleteProvider* search_provider = new SearchProvider(NULL, &profile_);
201 search_provider->AddRef(); 202 search_provider->AddRef();
202 providers_.push_back(search_provider); 203 providers_.push_back(search_provider);
203 204
204 AutocompleteController* controller = new AutocompleteController(providers_); 205 AutocompleteController* controller =
206 new AutocompleteController(providers_, &profile_);
205 controller_.reset(controller); 207 controller_.reset(controller);
206 } 208 }
207 209
208 void AutocompleteProviderTest::RunTest() { 210 void AutocompleteProviderTest::RunTest() {
209 result_.Reset(); 211 result_.Reset();
210 controller_->Start(ASCIIToUTF16("a"), string16(), true, false, true, 212 controller_->Start(ASCIIToUTF16("a"), string16(), true, false, true,
211 AutocompleteInput::ALL_MATCHES); 213 AutocompleteInput::ALL_MATCHES);
212 214
213 // The message loop will terminate when all autocomplete input has been 215 // The message loop will terminate when all autocomplete input has been
214 // collected. 216 // collected.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " << 473 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " <<
472 input_cases[i].input; 474 input_cases[i].input;
473 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " << 475 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " <<
474 input_cases[i].input; 476 input_cases[i].input;
475 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " << 477 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " <<
476 input_cases[i].input; 478 input_cases[i].input;
477 } 479 }
478 } 480 }
479 481
480 } // namespace 482 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.cc ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698