| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/ui/cocoa/cocoa_profile_test.h" | 5 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/search_engines/template_url_service_factory.h" | 12 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "components/bookmarks/test/bookmark_test_helpers.h" | 19 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 20 #include "components/syncable_prefs/pref_service_syncable.h" | 20 #include "components/sync_preferences/pref_service_syncable.h" |
| 21 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
| 22 | 22 |
| 23 CocoaProfileTest::CocoaProfileTest() | 23 CocoaProfileTest::CocoaProfileTest() |
| 24 : profile_manager_(TestingBrowserProcess::GetGlobal()), | 24 : profile_manager_(TestingBrowserProcess::GetGlobal()), |
| 25 profile_(NULL), | 25 profile_(NULL), |
| 26 thread_bundle_(new content::TestBrowserThreadBundle) { | 26 thread_bundle_(new content::TestBrowserThreadBundle) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 CocoaProfileTest::~CocoaProfileTest() { | 29 CocoaProfileTest::~CocoaProfileTest() { |
| 30 // Delete the testing profile on the UI thread. But first release the | 30 // Delete the testing profile on the UI thread. But first release the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 testing_factories_.push_back(testing_factory); | 49 testing_factories_.push_back(testing_factory); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CocoaProfileTest::SetUp() { | 53 void CocoaProfileTest::SetUp() { |
| 54 CocoaTest::SetUp(); | 54 CocoaTest::SetUp(); |
| 55 | 55 |
| 56 ASSERT_TRUE(profile_manager_.SetUp()); | 56 ASSERT_TRUE(profile_manager_.SetUp()); |
| 57 | 57 |
| 58 profile_ = profile_manager_.CreateTestingProfile( | 58 profile_ = profile_manager_.CreateTestingProfile( |
| 59 "Person 1", std::unique_ptr<syncable_prefs::PrefServiceSyncable>(), | 59 "Person 1", std::unique_ptr<sync_preferences::PrefServiceSyncable>(), |
| 60 base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories_); | 60 base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories_); |
| 61 ASSERT_TRUE(profile_); | 61 ASSERT_TRUE(profile_); |
| 62 | 62 |
| 63 // TODO(shess): These are needed in case someone creates a browser | 63 // TODO(shess): These are needed in case someone creates a browser |
| 64 // window off of browser_. pkasting indicates that other | 64 // window off of browser_. pkasting indicates that other |
| 65 // platforms use a stub |BrowserWindow| and thus don't need to do | 65 // platforms use a stub |BrowserWindow| and thus don't need to do |
| 66 // this. | 66 // this. |
| 67 // http://crbug.com/39725 | 67 // http://crbug.com/39725 |
| 68 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 68 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 69 profile_, &TemplateURLServiceFactory::BuildInstanceFor); | 69 profile_, &TemplateURLServiceFactory::BuildInstanceFor); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 90 DCHECK(browser_->window()); | 90 DCHECK(browser_->window()); |
| 91 browser_->tab_strip_model()->CloseAllTabs(); | 91 browser_->tab_strip_model()->CloseAllTabs(); |
| 92 chrome::CloseWindow(browser_.get()); | 92 chrome::CloseWindow(browser_.get()); |
| 93 // |browser_| will be deleted by its BrowserWindowController. | 93 // |browser_| will be deleted by its BrowserWindowController. |
| 94 ignore_result(browser_.release()); | 94 ignore_result(browser_.release()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 Browser* CocoaProfileTest::CreateBrowser() { | 97 Browser* CocoaProfileTest::CreateBrowser() { |
| 98 return new Browser(Browser::CreateParams(profile())); | 98 return new Browser(Browser::CreateParams(profile())); |
| 99 } | 99 } |
| OLD | NEW |