| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/autocomplete/autocomplete_match.h" | 11 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 12 #include "chrome/browser/autocomplete/keyword_provider.h" | 12 #include "chrome/browser/autocomplete/keyword_provider.h" |
| 13 #include "chrome/browser/autocomplete/search_provider.h" | 13 #include "chrome/browser/autocomplete/search_provider.h" |
| 14 #include "chrome/browser/search_engines/template_url.h" | 14 #include "chrome/browser/search_engines/template_url.h" |
| 15 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
| 16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/test/testing_browser_process.h" | 18 #include "chrome/test/testing_browser_process.h" |
| 18 #include "chrome/test/testing_browser_process_test.h" | 19 #include "chrome/test/testing_browser_process_test.h" |
| 19 #include "chrome/test/testing_profile.h" | 20 #include "chrome/test/testing_profile.h" |
| 20 #include "content/common/notification_observer.h" | 21 #include "content/common/notification_observer.h" |
| 21 #include "content/common/notification_registrar.h" | 22 #include "content/common/notification_registrar.h" |
| 22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 25 |
| 25 static std::ostream& operator<<(std::ostream& os, | 26 static std::ostream& operator<<(std::ostream& os, |
| 26 const AutocompleteResult::const_iterator& it) { | 27 const AutocompleteResult::const_iterator& it) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 providers_.push_back(providerB); | 153 providers_.push_back(providerB); |
| 153 | 154 |
| 154 // Reset the controller to contain our new providers. | 155 // Reset the controller to contain our new providers. |
| 155 AutocompleteController* controller = new AutocompleteController(providers_); | 156 AutocompleteController* controller = new AutocompleteController(providers_); |
| 156 controller_.reset(controller); | 157 controller_.reset(controller); |
| 157 providerA->set_listener(controller); | 158 providerA->set_listener(controller); |
| 158 providerB->set_listener(controller); | 159 providerB->set_listener(controller); |
| 159 | 160 |
| 160 // The providers don't complete synchronously, so listen for "result updated" | 161 // The providers don't complete synchronously, so listen for "result updated" |
| 161 // notifications. | 162 // notifications. |
| 162 registrar_.Add(this, NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 163 registrar_.Add(this, chrome::AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 163 NotificationService::AllSources()); | 164 NotificationService::AllSources()); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void AutocompleteProviderTest:: | 167 void AutocompleteProviderTest:: |
| 167 ResetControllerWithTestProvidersWithKeywordAndSearchProviders() { | 168 ResetControllerWithTestProvidersWithKeywordAndSearchProviders() { |
| 168 profile_.CreateTemplateURLService(); | 169 profile_.CreateTemplateURLService(); |
| 169 | 170 |
| 170 // Reset the default TemplateURL. | 171 // Reset the default TemplateURL. |
| 171 TemplateURL* default_t_url = new TemplateURL(); | 172 TemplateURL* default_t_url = new TemplateURL(); |
| 172 default_t_url->SetURL("http://defaultturl/{searchTerms}", 0, 0); | 173 default_t_url->SetURL("http://defaultturl/{searchTerms}", 0, 0); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " << | 470 EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " << |
| 470 input_cases[i].input; | 471 input_cases[i].input; |
| 471 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " << | 472 EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " << |
| 472 input_cases[i].input; | 473 input_cases[i].input; |
| 473 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " << | 474 EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " << |
| 474 input_cases[i].input; | 475 input_cases[i].input; |
| 475 } | 476 } |
| 476 } | 477 } |
| 477 | 478 |
| 478 } // namespace | 479 } // namespace |
| OLD | NEW |