| 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" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 70 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( | 70 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( |
| 71 profile_, &AutocompleteClassifierFactory::BuildInstanceFor); | 71 profile_, &AutocompleteClassifierFactory::BuildInstanceFor); |
| 72 | 72 |
| 73 profile_->CreateBookmarkModel(true); | 73 profile_->CreateBookmarkModel(true); |
| 74 bookmarks::test::WaitForBookmarkModelToLoad( | 74 bookmarks::test::WaitForBookmarkModelToLoad( |
| 75 BookmarkModelFactory::GetForProfile(profile_)); | 75 BookmarkModelFactory::GetForBrowserContext(profile_)); |
| 76 | 76 |
| 77 browser_.reset(CreateBrowser()); | 77 browser_.reset(CreateBrowser()); |
| 78 ASSERT_TRUE(browser_.get()); | 78 ASSERT_TRUE(browser_.get()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void CocoaProfileTest::TearDown() { | 81 void CocoaProfileTest::TearDown() { |
| 82 if (browser_.get() && browser_->window()) | 82 if (browser_.get() && browser_->window()) |
| 83 CloseBrowserWindow(); | 83 CloseBrowserWindow(); |
| 84 | 84 |
| 85 CocoaTest::TearDown(); | 85 CocoaTest::TearDown(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void CocoaProfileTest::CloseBrowserWindow() { | 88 void CocoaProfileTest::CloseBrowserWindow() { |
| 89 // Check to make sure a window was actually created. | 89 // Check to make sure a window was actually created. |
| 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 |