OLD | NEW |
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/autocomplete_provider.h" | 5 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 TestProvider(int relevance, const string16& prefix, | 45 TestProvider(int relevance, const string16& prefix, |
46 Profile* profile, | 46 Profile* profile, |
47 const string16 match_keyword) | 47 const string16 match_keyword) |
48 : AutocompleteProvider(NULL, profile, AutocompleteProvider::TYPE_SEARCH), | 48 : AutocompleteProvider(NULL, profile, AutocompleteProvider::TYPE_SEARCH), |
49 relevance_(relevance), | 49 relevance_(relevance), |
50 prefix_(prefix), | 50 prefix_(prefix), |
51 match_keyword_(match_keyword) { | 51 match_keyword_(match_keyword) { |
52 } | 52 } |
53 | 53 |
54 virtual void Start(const AutocompleteInput& input, | 54 virtual void Start(const AutocompleteInput& input, |
55 bool minimal_changes); | 55 bool minimal_changes) OVERRIDE; |
56 | 56 |
57 void set_listener(AutocompleteProviderListener* listener) { | 57 void set_listener(AutocompleteProviderListener* listener) { |
58 listener_ = listener; | 58 listener_ = listener; |
59 } | 59 } |
60 | 60 |
61 private: | 61 private: |
62 virtual ~TestProvider() {} | 62 virtual ~TestProvider() {} |
63 | 63 |
64 void Run(); | 64 void Run(); |
65 | 65 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void ResetControllerWithKeywordProvider(); | 185 void ResetControllerWithKeywordProvider(); |
186 void RunExactKeymatchTest(bool allow_exact_keyword_match); | 186 void RunExactKeymatchTest(bool allow_exact_keyword_match); |
187 | 187 |
188 AutocompleteResult result_; | 188 AutocompleteResult result_; |
189 scoped_ptr<AutocompleteController> controller_; | 189 scoped_ptr<AutocompleteController> controller_; |
190 | 190 |
191 private: | 191 private: |
192 // content::NotificationObserver | 192 // content::NotificationObserver |
193 virtual void Observe(int type, | 193 virtual void Observe(int type, |
194 const content::NotificationSource& source, | 194 const content::NotificationSource& source, |
195 const content::NotificationDetails& details); | 195 const content::NotificationDetails& details) OVERRIDE; |
196 | 196 |
197 MessageLoopForUI message_loop_; | 197 MessageLoopForUI message_loop_; |
198 content::NotificationRegistrar registrar_; | 198 content::NotificationRegistrar registrar_; |
199 TestingProfile profile_; | 199 TestingProfile profile_; |
200 }; | 200 }; |
201 | 201 |
202 void AutocompleteProviderTest::RegisterTemplateURL( | 202 void AutocompleteProviderTest::RegisterTemplateURL( |
203 const string16 keyword, | 203 const string16 keyword, |
204 const std::string& template_url) { | 204 const std::string& template_url) { |
205 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 205 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 { AutocompleteMatch::NAVSUGGEST, "chrome.3.57j58j5l2j0l3j59" }, | 543 { AutocompleteMatch::NAVSUGGEST, "chrome.3.57j58j5l2j0l3j59" }, |
544 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.4.57j58j5l2j0l3j59" }, | 544 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.4.57j58j5l2j0l3j59" }, |
545 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.5.57j58j5l2j0l3j59" }, | 545 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.5.57j58j5l2j0l3j59" }, |
546 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.6.57j58j5l2j0l3j59" }, | 546 { AutocompleteMatch::SEARCH_SUGGEST, "chrome.6.57j58j5l2j0l3j59" }, |
547 { AutocompleteMatch::SEARCH_HISTORY, "chrome.7.57j58j5l2j0l3j59" }, | 547 { AutocompleteMatch::SEARCH_HISTORY, "chrome.7.57j58j5l2j0l3j59" }, |
548 }; | 548 }; |
549 SCOPED_TRACE("Multiple matches"); | 549 SCOPED_TRACE("Multiple matches"); |
550 RunAssistedQueryStatsTest(test_data, ARRAYSIZE_UNSAFE(test_data)); | 550 RunAssistedQueryStatsTest(test_data, ARRAYSIZE_UNSAFE(test_data)); |
551 } | 551 } |
552 } | 552 } |
OLD | NEW |