| 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 "components/omnibox/autocomplete_provider.h" | 5 #include "components/omnibox/autocomplete_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const base::string16 match_keyword) | 51 const base::string16 match_keyword) |
| 52 : AutocompleteProvider(AutocompleteProvider::TYPE_SEARCH), | 52 : AutocompleteProvider(AutocompleteProvider::TYPE_SEARCH), |
| 53 listener_(NULL), | 53 listener_(NULL), |
| 54 profile_(profile), | 54 profile_(profile), |
| 55 relevance_(relevance), | 55 relevance_(relevance), |
| 56 prefix_(prefix), | 56 prefix_(prefix), |
| 57 match_keyword_(match_keyword) { | 57 match_keyword_(match_keyword) { |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void Start(const AutocompleteInput& input, | 60 virtual void Start(const AutocompleteInput& input, |
| 61 bool minimal_changes) OVERRIDE; | 61 bool minimal_changes) override; |
| 62 | 62 |
| 63 void set_listener(AutocompleteProviderListener* listener) { | 63 void set_listener(AutocompleteProviderListener* listener) { |
| 64 listener_ = listener; | 64 listener_ = listener; |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 virtual ~TestProvider() {} | 68 virtual ~TestProvider() {} |
| 69 | 69 |
| 70 void Run(); | 70 void Run(); |
| 71 | 71 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 GURL GetDestinationURL(AutocompleteMatch match, | 210 GURL GetDestinationURL(AutocompleteMatch match, |
| 211 base::TimeDelta query_formulation_time) const; | 211 base::TimeDelta query_formulation_time) const; |
| 212 | 212 |
| 213 AutocompleteResult result_; | 213 AutocompleteResult result_; |
| 214 scoped_ptr<AutocompleteController> controller_; | 214 scoped_ptr<AutocompleteController> controller_; |
| 215 | 215 |
| 216 private: | 216 private: |
| 217 // content::NotificationObserver: | 217 // content::NotificationObserver: |
| 218 virtual void Observe(int type, | 218 virtual void Observe(int type, |
| 219 const content::NotificationSource& source, | 219 const content::NotificationSource& source, |
| 220 const content::NotificationDetails& details) OVERRIDE; | 220 const content::NotificationDetails& details) override; |
| 221 | 221 |
| 222 base::MessageLoopForUI message_loop_; | 222 base::MessageLoopForUI message_loop_; |
| 223 content::NotificationRegistrar registrar_; | 223 content::NotificationRegistrar registrar_; |
| 224 TestingProfile profile_; | 224 TestingProfile profile_; |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 void AutocompleteProviderTest::RegisterTemplateURL( | 227 void AutocompleteProviderTest::RegisterTemplateURL( |
| 228 const base::string16 keyword, | 228 const base::string16 keyword, |
| 229 const std::string& template_url) { | 229 const std::string& template_url) { |
| 230 if (TemplateURLServiceFactory::GetForProfile(&profile_) == NULL) { | 230 if (TemplateURLServiceFactory::GetForProfile(&profile_) == NULL) { |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 728 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
| 729 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); | 729 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); |
| 730 | 730 |
| 731 // Test page classification and field trial triggered set. | 731 // Test page classification and field trial triggered set. |
| 732 controller_->search_provider_->field_trial_triggered_in_session_ = true; | 732 controller_->search_provider_->field_trial_triggered_in_session_ = true; |
| 733 EXPECT_TRUE( | 733 EXPECT_TRUE( |
| 734 controller_->search_provider_->field_trial_triggered_in_session()); | 734 controller_->search_provider_->field_trial_triggered_in_session()); |
| 735 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); | 735 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); |
| 736 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); | 736 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); |
| 737 } | 737 } |
| OLD | NEW |