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

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

Issue 276063003: Remove a call to initialize the TemplateURLService factory in this test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some more adjustments. Created 6 years, 7 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 "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 8 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 void CocoaProfileTest::SetUp() { 44 void CocoaProfileTest::SetUp() {
45 CocoaTest::SetUp(); 45 CocoaTest::SetUp();
46 46
47 ASSERT_TRUE(profile_manager_.SetUp()); 47 ASSERT_TRUE(profile_manager_.SetUp());
48 48
49 profile_ = profile_manager_.CreateTestingProfile("default"); 49 profile_ = profile_manager_.CreateTestingProfile("default");
50 ASSERT_TRUE(profile_); 50 ASSERT_TRUE(profile_);
51 51
52 profile_->CreateBookmarkModel(true);
53 test::WaitForBookmarkModelToLoad(
54 BookmarkModelFactory::GetForProfile(profile_));
55
56 // TODO(shess): These are needed in case someone creates a browser 52 // TODO(shess): These are needed in case someone creates a browser
57 // window off of browser_. pkasting indicates that other 53 // window off of browser_. pkasting indicates that other
58 // platforms use a stub |BrowserWindow| and thus don't need to do 54 // platforms use a stub |BrowserWindow| and thus don't need to do
59 // this. 55 // this.
60 // http://crbug.com/39725 56 // http://crbug.com/39725
61 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 57 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
62 profile_, &TemplateURLServiceFactory::BuildInstanceFor); 58 profile_, &TemplateURLServiceFactory::BuildInstanceFor);
63 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 59 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
64 profile_, &AutocompleteClassifierFactory::BuildInstanceFor); 60 profile_, &AutocompleteClassifierFactory::BuildInstanceFor);
65 61
62 profile_->CreateBookmarkModel(true);
63 test::WaitForBookmarkModelToLoad(
64 BookmarkModelFactory::GetForProfile(profile_));
65
66 browser_.reset(CreateBrowser()); 66 browser_.reset(CreateBrowser());
67 ASSERT_TRUE(browser_.get()); 67 ASSERT_TRUE(browser_.get());
68 } 68 }
69 69
70 void CocoaProfileTest::TearDown() { 70 void CocoaProfileTest::TearDown() {
71 if (browser_.get() && browser_->window()) 71 if (browser_.get() && browser_->window())
72 CloseBrowserWindow(); 72 CloseBrowserWindow();
73 73
74 CocoaTest::TearDown(); 74 CocoaTest::TearDown();
75 } 75 }
76 76
77 void CocoaProfileTest::CloseBrowserWindow() { 77 void CocoaProfileTest::CloseBrowserWindow() {
78 // Check to make sure a window was actually created. 78 // Check to make sure a window was actually created.
79 DCHECK(browser_->window()); 79 DCHECK(browser_->window());
80 browser_->tab_strip_model()->CloseAllTabs(); 80 browser_->tab_strip_model()->CloseAllTabs();
81 chrome::CloseWindow(browser_.get()); 81 chrome::CloseWindow(browser_.get());
82 // |browser_| will be deleted by its BrowserWindowController. 82 // |browser_| will be deleted by its BrowserWindowController.
83 ignore_result(browser_.release()); 83 ignore_result(browser_.release());
84 } 84 }
85 85
86 Browser* CocoaProfileTest::CreateBrowser() { 86 Browser* CocoaProfileTest::CreateBrowser() {
87 return new Browser(Browser::CreateParams(profile(), 87 return new Browser(Browser::CreateParams(profile(),
88 chrome::GetActiveDesktop())); 88 chrome::GetActiveDesktop()));
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698