| 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 "base/memory/ptr_util.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 10 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 10 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/test/base/testing_io_thread_state.h" | 22 #include "chrome/test/base/testing_io_thread_state.h" |
| 23 #include "components/omnibox/browser/autocomplete_classifier.h" | 23 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 24 #include "components/omnibox/browser/autocomplete_controller.h" | 24 #include "components/omnibox/browser/autocomplete_controller.h" |
| 25 #include "components/omnibox/browser/test_scheme_classifier.h" | 25 #include "components/omnibox/browser/test_scheme_classifier.h" |
| 26 #include "components/search_engines/search_terms_data.h" | 26 #include "components/search_engines/search_terms_data.h" |
| 27 #include "components/search_engines/template_url_service.h" | 27 #include "components/search_engines/template_url_service.h" |
| 28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 31 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 32 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 32 #include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 std::unique_ptr<KeyedService> CreateTemplateURLService( | 37 std::unique_ptr<KeyedService> CreateTemplateURLService( |
| 38 content::BrowserContext* context) { | 38 content::BrowserContext* context) { |
| 39 Profile* profile = static_cast<Profile*>(context); | 39 Profile* profile = static_cast<Profile*>(context); |
| 40 return base::MakeUnique<TemplateURLService>( | 40 return base::MakeUnique<TemplateURLService>( |
| 41 profile->GetPrefs(), | 41 profile->GetPrefs(), |
| 42 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), | 42 std::unique_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 : BrowserWithTestWindowTest(browser_type, hosted_app) {} | 71 : BrowserWithTestWindowTest(browser_type, hosted_app) {} |
| 72 | 72 |
| 73 TestWithBrowserView::~TestWithBrowserView() { | 73 TestWithBrowserView::~TestWithBrowserView() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 void TestWithBrowserView::SetUp() { | 76 void TestWithBrowserView::SetUp() { |
| 77 local_state_.reset( | 77 local_state_.reset( |
| 78 new ScopedTestingLocalState(TestingBrowserProcess::GetGlobal())); | 78 new ScopedTestingLocalState(TestingBrowserProcess::GetGlobal())); |
| 79 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 80 chromeos::input_method::InitializeForTesting( | 80 chromeos::input_method::InitializeForTesting( |
| 81 new chromeos::input_method::MockInputMethodManager); | 81 new chromeos::input_method::MockInputMethodManagerImpl); |
| 82 #endif | 82 #endif |
| 83 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); | 83 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); |
| 84 BrowserWithTestWindowTest::SetUp(); | 84 BrowserWithTestWindowTest::SetUp(); |
| 85 predictor_db_.reset(new predictors::PredictorDatabase(GetProfile())); | 85 predictor_db_.reset(new predictors::PredictorDatabase(GetProfile())); |
| 86 browser_view_ = static_cast<BrowserView*>(browser()->window()); | 86 browser_view_ = static_cast<BrowserView*>(browser()->window()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void TestWithBrowserView::TearDown() { | 89 void TestWithBrowserView::TearDown() { |
| 90 // Both BrowserView and BrowserWithTestWindowTest believe they have ownership | 90 // Both BrowserView and BrowserWithTestWindowTest believe they have ownership |
| 91 // of the Browser. Force BrowserWithTestWindowTest to give up ownership. | 91 // of the Browser. Force BrowserWithTestWindowTest to give up ownership. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( | 118 AutocompleteClassifierFactory::GetInstance()->SetTestingFactory( |
| 119 profile, &CreateAutocompleteClassifier); | 119 profile, &CreateAutocompleteClassifier); |
| 120 return profile; | 120 return profile; |
| 121 } | 121 } |
| 122 | 122 |
| 123 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { | 123 BrowserWindow* TestWithBrowserView::CreateBrowserWindow() { |
| 124 // Allow BrowserWithTestWindowTest to use Browser to create the default | 124 // Allow BrowserWithTestWindowTest to use Browser to create the default |
| 125 // BrowserView and BrowserFrame. | 125 // BrowserView and BrowserFrame. |
| 126 return nullptr; | 126 return nullptr; |
| 127 } | 127 } |
| OLD | NEW |