| 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 "base/memory/ptr_util.h" |
| 7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 9 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 10 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
| 11 #include "chrome/browser/predictors/predictor_database.h" | 12 #include "chrome/browser/predictors/predictor_database.h" |
| 12 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" | 13 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
| 13 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 14 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 15 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 17 #include "chrome/browser/web_data_service_factory.h" | 18 #include "chrome/browser/web_data_service_factory.h" |
| 18 #include "chrome/test/base/browser_with_test_window_test.h" | 19 #include "chrome/test/base/browser_with_test_window_test.h" |
| 19 #include "chrome/test/base/scoped_testing_local_state.h" | 20 #include "chrome/test/base/scoped_testing_local_state.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_io_thread_state.h" | 22 #include "chrome/test/base/testing_io_thread_state.h" |
| 22 #include "components/omnibox/browser/autocomplete_classifier.h" | 23 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 23 #include "components/omnibox/browser/autocomplete_controller.h" | 24 #include "components/omnibox/browser/autocomplete_controller.h" |
| 24 #include "components/omnibox/browser/test_scheme_classifier.h" | 25 #include "components/omnibox/browser/test_scheme_classifier.h" |
| 25 #include "components/search_engines/search_terms_data.h" | 26 #include "components/search_engines/search_terms_data.h" |
| 26 #include "components/search_engines/template_url_service.h" | 27 #include "components/search_engines/template_url_service.h" |
| 27 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 28 | 29 |
| 29 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 30 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 31 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 31 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 32 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 scoped_ptr<KeyedService> CreateTemplateURLService( | 37 std::unique_ptr<KeyedService> CreateTemplateURLService( |
| 37 content::BrowserContext* context) { | 38 content::BrowserContext* context) { |
| 38 Profile* profile = static_cast<Profile*>(context); | 39 Profile* profile = static_cast<Profile*>(context); |
| 39 return make_scoped_ptr(new TemplateURLService( | 40 return base::WrapUnique(new TemplateURLService( |
| 40 profile->GetPrefs(), | 41 profile->GetPrefs(), |
| 41 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), | 42 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
| 42 WebDataServiceFactory::GetKeywordWebDataForProfile( | 43 WebDataServiceFactory::GetKeywordWebDataForProfile( |
| 43 profile, ServiceAccessType::EXPLICIT_ACCESS), | 44 profile, ServiceAccessType::EXPLICIT_ACCESS), |
| 44 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( | 45 std::unique_ptr<TemplateURLServiceClient>( |
| 45 HistoryServiceFactory::GetForProfile( | 46 new ChromeTemplateURLServiceClient( |
| 46 profile, ServiceAccessType::EXPLICIT_ACCESS))), | 47 HistoryServiceFactory::GetForProfile( |
| 48 profile, ServiceAccessType::EXPLICIT_ACCESS))), |
| 47 nullptr, nullptr, base::Closure())); | 49 nullptr, nullptr, base::Closure())); |
| 48 } | 50 } |
| 49 | 51 |
| 50 scoped_ptr<KeyedService> CreateAutocompleteClassifier( | 52 std::unique_ptr<KeyedService> CreateAutocompleteClassifier( |
| 51 content::BrowserContext* context) { | 53 content::BrowserContext* context) { |
| 52 Profile* profile = static_cast<Profile*>(context); | 54 Profile* profile = static_cast<Profile*>(context); |
| 53 return make_scoped_ptr(new AutocompleteClassifier( | 55 return base::WrapUnique(new AutocompleteClassifier( |
| 54 make_scoped_ptr(new AutocompleteController( | 56 base::WrapUnique(new AutocompleteController( |
| 55 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile)), | 57 base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), |
| 56 | 58 |
| 57 nullptr, AutocompleteClassifier::kDefaultOmniboxProviders)), | 59 nullptr, AutocompleteClassifier::kDefaultOmniboxProviders)), |
| 58 scoped_ptr<AutocompleteSchemeClassifier>(new TestSchemeClassifier()))); | 60 std::unique_ptr<AutocompleteSchemeClassifier>( |
| 61 new TestSchemeClassifier()))); |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace | 64 } // namespace |
| 62 | 65 |
| 63 TestWithBrowserView::TestWithBrowserView() { | 66 TestWithBrowserView::TestWithBrowserView() { |
| 64 } | 67 } |
| 65 | 68 |
| 66 TestWithBrowserView::TestWithBrowserView(Browser::Type browser_type, | 69 TestWithBrowserView::TestWithBrowserView(Browser::Type browser_type, |
| 67 bool hosted_app) | 70 bool hosted_app) |
| 68 : BrowserWithTestWindowTest(browser_type, hosted_app) {} | 71 : BrowserWithTestWindowTest(browser_type, hosted_app) {} |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( | 118 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( |
| 116 profile, &CreateAutocompleteClassifier); | 119 profile, &CreateAutocompleteClassifier); |
| 117 return profile; | 120 return profile; |
| 118 } | 121 } |
| 119 | 122 |
| 120 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { | 123 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { |
| 121 // Allow BrowserWithTestWindowTest to use Browser to create the default | 124 // Allow BrowserWithTestWindowTest to use Browser to create the default |
| 122 // BrowserView and BrowserFrame. | 125 // BrowserView and BrowserFrame. |
| 123 return nullptr; | 126 return nullptr; |
| 124 } | 127 } |
| OLD | NEW |