| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 19 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 20 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_input.h" | 21 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 22 #include "chrome/browser/autocomplete/autocomplete_match.h" | 22 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 23 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 23 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 24 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" | 24 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" |
| 25 #include "chrome/browser/autocomplete/history_url_provider.h" | 25 #include "chrome/browser/autocomplete/history_url_provider.h" |
| 26 #include "chrome/browser/history/history_service.h" | 26 #include "chrome/browser/history/history_service.h" |
| 27 #include "chrome/browser/history/history_service_factory.h" | 27 #include "chrome/browser/history/history_service_factory.h" |
| 28 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 28 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 29 #include "chrome/browser/search/search.h" | |
| 30 #include "chrome/browser/search_engines/search_engine_type.h" | 29 #include "chrome/browser/search_engines/search_engine_type.h" |
| 31 #include "chrome/browser/search_engines/template_url.h" | 30 #include "chrome/browser/search_engines/template_url.h" |
| 32 #include "chrome/browser/search_engines/template_url_service.h" | 31 #include "chrome/browser/search_engines/template_url_service.h" |
| 33 #include "chrome/browser/search_engines/template_url_service_factory.h" | 32 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 34 #include "chrome/browser/signin/signin_manager.h" | 33 #include "chrome/browser/signin/signin_manager.h" |
| 35 #include "chrome/browser/signin/signin_manager_factory.h" | 34 #include "chrome/browser/signin/signin_manager_factory.h" |
| 36 #include "chrome/browser/sync/profile_sync_service.h" | 35 #include "chrome/browser/sync/profile_sync_service.h" |
| 37 #include "chrome/browser/sync/profile_sync_service_factory.h" | 36 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 38 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/metrics/variations/variations_util.h" | 38 #include "chrome/common/metrics/variations/variations_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // If non-NULL, OnProviderUpdate quits the current |run_loop_|. | 175 // If non-NULL, OnProviderUpdate quits the current |run_loop_|. |
| 177 base::RunLoop* run_loop_; | 176 base::RunLoop* run_loop_; |
| 178 | 177 |
| 179 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); | 178 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); |
| 180 }; | 179 }; |
| 181 | 180 |
| 182 // static | 181 // static |
| 183 const std::string SearchProviderTest::kNotApplicable = "Not Applicable"; | 182 const std::string SearchProviderTest::kNotApplicable = "Not Applicable"; |
| 184 | 183 |
| 185 void SearchProviderTest::SetUp() { | 184 void SearchProviderTest::SetUp() { |
| 186 chrome::EnableInstantExtendedAPIForTesting(); | |
| 187 | |
| 188 // Make sure that fetchers are automatically ungregistered upon destruction. | 185 // Make sure that fetchers are automatically ungregistered upon destruction. |
| 189 test_factory_.set_remove_fetcher_on_delete(true); | 186 test_factory_.set_remove_fetcher_on_delete(true); |
| 190 | 187 |
| 191 // We need both the history service and template url model loaded. | 188 // We need both the history service and template url model loaded. |
| 192 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); | 189 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); |
| 193 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 190 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 194 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); | 191 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); |
| 195 | 192 |
| 196 TemplateURLService* turl_model = | 193 TemplateURLService* turl_model = |
| 197 TemplateURLServiceFactory::GetForProfile(&profile_); | 194 TemplateURLServiceFactory::GetForProfile(&profile_); |
| (...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3946 AutocompleteInput::OTHER, &profile_)); | 3943 AutocompleteInput::OTHER, &profile_)); |
| 3947 encrypted_types.Remove(syncer::SESSIONS); | 3944 encrypted_types.Remove(syncer::SESSIONS); |
| 3948 service->OnEncryptedTypesChanged(encrypted_types, false); | 3945 service->OnEncryptedTypesChanged(encrypted_types, false); |
| 3949 | 3946 |
| 3950 // Check that there were no side effects from previous tests. | 3947 // Check that there were no side effects from previous tests. |
| 3951 EXPECT_TRUE(SearchProvider::CanSendURL( | 3948 EXPECT_TRUE(SearchProvider::CanSendURL( |
| 3952 GURL("http://www.google.com/search"), | 3949 GURL("http://www.google.com/search"), |
| 3953 GURL("https://www.google.com/complete/search"), &google_template_url, | 3950 GURL("https://www.google.com/complete/search"), &google_template_url, |
| 3954 AutocompleteInput::OTHER, &profile_)); | 3951 AutocompleteInput::OTHER, &profile_)); |
| 3955 } | 3952 } |
| OLD | NEW |