| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/frame/test_with_browser_view.h" | 5 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 9 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 10 #include "chrome/browser/predictors/predictor_database.h" | 10 #include "chrome/browser/predictors/predictor_database.h" |
| 11 #include "chrome/browser/search_engines/keyword_history_service.h" |
| 11 #include "chrome/browser/search_engines/template_url_service.h" | 12 #include "chrome/browser/search_engines/template_url_service.h" |
| 12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 13 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 14 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 17 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 15 #include "chrome/test/base/browser_with_test_window_test.h" | 18 #include "chrome/test/base/browser_with_test_window_test.h" |
| 16 #include "chrome/test/base/scoped_testing_local_state.h" | 19 #include "chrome/test/base/scoped_testing_local_state.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 20 #include "chrome/test/base/testing_browser_process.h" |
| 18 #include "chrome/test/base/testing_io_thread_state.h" | 21 #include "chrome/test/base/testing_io_thread_state.h" |
| 19 #include "components/autocomplete/test_scheme_classifier.h" | 22 #include "components/autocomplete/test_scheme_classifier.h" |
| 23 #include "components/search_engines/search_terms_data.h" |
| 20 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
| 21 | 25 |
| 22 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 23 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 24 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 28 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
| 25 #endif | 29 #endif |
| 26 | 30 |
| 27 namespace { | 31 namespace { |
| 28 | 32 |
| 29 // Caller owns the returned service. | 33 // Caller owns the returned service. |
| 30 KeyedService* CreateTemplateURLService(content::BrowserContext* profile) { | 34 KeyedService* CreateTemplateURLService(content::BrowserContext* context) { |
| 31 return new TemplateURLService(static_cast<Profile*>(profile), NULL, | 35 Profile* profile = static_cast<Profile*>(context); |
| 32 base::Closure()); | 36 return new TemplateURLService( |
| 37 profile->GetPrefs(), |
| 38 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
| 39 WebDataServiceFactory::GetKeywordWebDataForProfile( |
| 40 profile, Profile::EXPLICIT_ACCESS), |
| 41 scoped_ptr<KeywordHistoryServiceInterface>( |
| 42 new KeywordHistoryService(profile)), NULL, NULL, base::Closure()); |
| 33 } | 43 } |
| 34 | 44 |
| 35 KeyedService* CreateAutocompleteClassifier(content::BrowserContext* profile) { | 45 KeyedService* CreateAutocompleteClassifier(content::BrowserContext* profile) { |
| 36 return new AutocompleteClassifier( | 46 return new AutocompleteClassifier( |
| 37 make_scoped_ptr(new AutocompleteController( | 47 make_scoped_ptr(new AutocompleteController( |
| 38 static_cast<Profile*>(profile), NULL, | 48 static_cast<Profile*>(profile), NULL, |
| 39 AutocompleteClassifier::kDefaultOmniboxProviders)), | 49 AutocompleteClassifier::kDefaultOmniboxProviders)), |
| 40 scoped_ptr<AutocompleteSchemeClassifier>(new TestSchemeClassifier())); | 50 scoped_ptr<AutocompleteSchemeClassifier>(new TestSchemeClassifier())); |
| 41 } | 51 } |
| 42 | 52 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( | 112 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( |
| 103 profile, &CreateAutocompleteClassifier); | 113 profile, &CreateAutocompleteClassifier); |
| 104 return profile; | 114 return profile; |
| 105 } | 115 } |
| 106 | 116 |
| 107 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { | 117 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { |
| 108 // Allow BrowserWithTestWindowTest to use Browser to create the default | 118 // Allow BrowserWithTestWindowTest to use Browser to create the default |
| 109 // BrowserView and BrowserFrame. | 119 // BrowserView and BrowserFrame. |
| 110 return NULL; | 120 return NULL; |
| 111 } | 121 } |
| OLD | NEW |