Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/ui/cocoa/cocoa_profile_test.mm

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 7 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 9 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // TODO(shess): These are needed in case someone creates a browser 64 // TODO(shess): These are needed in case someone creates a browser
65 // window off of browser_. pkasting indicates that other 65 // window off of browser_. pkasting indicates that other
66 // platforms use a stub |BrowserWindow| and thus don't need to do 66 // platforms use a stub |BrowserWindow| and thus don't need to do
67 // this. 67 // this.
68 // http://crbug.com/39725 68 // http://crbug.com/39725
69 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 69 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
70 profile_, &TemplateURLServiceFactory::BuildInstanceFor); 70 profile_, &TemplateURLServiceFactory::BuildInstanceFor);
71 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 71 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
72 profile_, &AutocompleteClassifierFactory::BuildInstanceFor); 72 profile_, &AutocompleteClassifierFactory::BuildInstanceFor);
73 73
74 browser_.reset(new Browser(Browser::TYPE_TABBED, profile_)); 74 browser_.reset(CreateBrowser());
75 ASSERT_TRUE(browser_.get()); 75 ASSERT_TRUE(browser_.get());
76 } 76 }
77 77
78 void CocoaProfileTest::TearDown() { 78 void CocoaProfileTest::TearDown() {
79 if (browser_.get() && browser_->window()) 79 if (browser_.get() && browser_->window())
80 CloseBrowserWindow(); 80 CloseBrowserWindow();
81 81
82 CocoaTest::TearDown(); 82 CocoaTest::TearDown();
83 } 83 }
84 84
85 BrowserWindow* CocoaProfileTest::CreateBrowserWindow() {
86 browser_->InitBrowserWindow();
87 return browser_->window();
88 }
89
90 void CocoaProfileTest::CloseBrowserWindow() { 85 void CocoaProfileTest::CloseBrowserWindow() {
91 // Check to make sure a window was actually created. 86 // Check to make sure a window was actually created.
92 DCHECK(browser_->window()); 87 DCHECK(browser_->window());
93 chrome::CloseAllTabs(browser_.get()); 88 chrome::CloseAllTabs(browser_.get());
94 chrome::CloseWindow(browser_.get()); 89 chrome::CloseWindow(browser_.get());
95 // |browser_| will be deleted by its BrowserWindowController. 90 // |browser_| will be deleted by its BrowserWindowController.
96 ignore_result(browser_.release()); 91 ignore_result(browser_.release());
97 } 92 }
93
94 Browser* CocoaProfileTest::CreateBrowser() {
95 return new Browser(Browser::CreateParams(profile()));
96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698