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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Replace in .mm files Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
index bdb05cd7329aa528b5402855eb48904ae7d93d8c..9ba3378bc83cb2760e15a7bb1722fc311d3f6d64 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -523,7 +523,7 @@ TEST_F(BookmarkBarControllerTest, FrameChangeNotification) {
// Confirm our "no items" container goes away when we add the 1st
// bookmark, and comes back when we delete the bookmark.
TEST_F(BookmarkBarControllerTest, NoItemContainerGoesAway) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* bar = model->bookmark_bar_node();
[bar_ loaded:model];
@@ -556,7 +556,7 @@ TEST_F(BookmarkBarControllerTest, NoItemContainerGoesAway) {
// Confirm off the side button only enabled when reasonable.
TEST_F(BookmarkBarControllerTest, OffTheSideButtonHidden) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
[bar_ loaded:model];
EXPECT_TRUE([bar_ offTheSideButtonIsHidden]);
@@ -605,7 +605,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideButtonHidden) {
// off-the-side menu while it is open. This test tries to bang hard
// in this area to reproduce the crash.
TEST_F(BookmarkBarControllerTest, DeleteFromOffTheSideWhileItIsOpen) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
[bar_ loaded:model];
// Add a lot of bookmarks (per the bug).
@@ -687,7 +687,7 @@ TEST_F(BookmarkBarControllerTest, TagMap) {
}
TEST_F(BookmarkBarControllerTest, MenuForFolderNode) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
// First make sure something (e.g. "(empty)" string) is always present.
NSMenu* menu = [bar_ menuForFolderNode:model->bookmark_bar_node()];
@@ -751,7 +751,7 @@ TEST_F(BookmarkBarControllerTest, OpenBookmark) {
}
TEST_F(BookmarkBarControllerTest, TestAddRemoveAndClear) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
NSView* buttonView = [bar_ buttonView];
EXPECT_EQ(0U, [[bar_ buttons] count]);
unsigned int initial_subview_count = [[buttonView subviews] count];
@@ -801,7 +801,7 @@ TEST_F(BookmarkBarControllerTest, TestAddRemoveAndClear) {
// Make sure we don't create too many buttons; we only really need
// ones that will be visible.
TEST_F(BookmarkBarControllerTest, TestButtonLimits) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
EXPECT_EQ(0U, [[bar_ buttons] count]);
// Add one; make sure we see it.
const BookmarkNode* parent = model->bookmark_bar_node();
@@ -861,7 +861,7 @@ TEST_F(BookmarkBarControllerTest, TestButtonMarch) {
TEST_F(BookmarkBarControllerTest, CheckForGrowth) {
WithNoAnimation at_all; // Turn off Cocoa auto animation in this scope.
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
GURL gurl1("http://www.google.com");
base::string16 title1(ASCIIToUTF16("x"));
bookmarks::AddIfNotBookmarked(model, gurl1, title1);
@@ -888,7 +888,7 @@ TEST_F(BookmarkBarControllerTest, CheckForGrowth) {
}
TEST_F(BookmarkBarControllerTest, DeleteBookmark) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const char* urls[] = { "https://secret.url.com",
"http://super.duper.web.site.for.doodz.gov",
@@ -912,7 +912,7 @@ TEST_F(BookmarkBarControllerTest, DeleteBookmark) {
// checkForBookmarkButtonGrowth:.
TEST_F(BookmarkBarControllerTest, Cell) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
[bar_ loaded:model];
const BookmarkNode* parent = model->bookmark_bar_node();
@@ -944,7 +944,7 @@ TEST_F(BookmarkBarControllerTest, Display) {
// Test that middle clicking on a bookmark button results in an open action,
// except for offTheSideButton, as it just opens its folder menu.
TEST_F(BookmarkBarControllerTest, MiddleClick) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
GURL gurl1("http://www.google.com/");
base::string16 title1(ASCIIToUTF16("x"));
bookmarks::AddIfNotBookmarked(model, gurl1, title1);
@@ -990,13 +990,13 @@ TEST_F(BookmarkBarControllerTest, MiddleClick) {
}
TEST_F(BookmarkBarControllerTest, DisplaysHelpMessageOnEmpty) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
[bar_ loaded:model];
EXPECT_FALSE([[[bar_ buttonView] noItemContainer] isHidden]);
}
TEST_F(BookmarkBarControllerTest, HidesHelpMessageWithBookmark) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* parent = model->bookmark_bar_node();
model->AddURL(parent, parent->child_count(),
@@ -1007,7 +1007,7 @@ TEST_F(BookmarkBarControllerTest, HidesHelpMessageWithBookmark) {
}
TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* parent = model->bookmark_bar_node();
model->AddURL(parent, parent->child_count(),
@@ -1058,7 +1058,7 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) {
[nstitles addObject:base::SysUTF8ToNSString(titles[i])];
}
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* parent = model->bookmark_bar_node();
[bar_ addURLs:nsurls withTitles:nstitles at:NSZeroPoint];
EXPECT_EQ(4, parent->child_count());
@@ -1079,7 +1079,7 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) {
TEST_F(BookmarkBarControllerTest, TestDragButton) {
WithNoAnimation at_all;
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
GURL gurls[] = { GURL("http://www.google.com/a"),
GURL("http://www.google.com/b"),
@@ -1151,7 +1151,7 @@ TEST_F(BookmarkBarControllerTest, TestDragButton) {
}
TEST_F(BookmarkBarControllerTest, TestCopyButton) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
GURL gurls[] = { GURL("http://www.google.com/a"),
GURL("http://www.google.com/b"),
@@ -1181,7 +1181,7 @@ TEST_F(BookmarkBarControllerTest, TestCopyButton) {
// Fake a theme with colored text. Apply it and make sure bookmark
// buttons have the same colored text. Repeat more than once.
TEST_F(BookmarkBarControllerTest, TestThemedButton) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
bookmarks::AddIfNotBookmarked(
model, GURL("http://www.foo.com"), ASCIIToUTF16("small"));
BookmarkButton* button = [[bar_ buttons] objectAtIndex:0];
@@ -1207,7 +1207,7 @@ TEST_F(BookmarkBarControllerTest, TestThemedButton) {
// Test that delegates and targets of buttons are cleared on dealloc.
TEST_F(BookmarkBarControllerTest, TestClearOnDealloc) {
// Make some bookmark buttons.
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
GURL gurls[] = { GURL("http://www.foo.com/"),
GURL("http://www.bar.com/"),
GURL("http://www.baz.com/") };
@@ -1242,7 +1242,7 @@ TEST_F(BookmarkBarControllerTest, TestClearOnDealloc) {
}
TEST_F(BookmarkBarControllerTest, TestFolders) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
// Create some folder buttons.
const BookmarkNode* parent = model->bookmark_bar_node();
@@ -1286,7 +1286,7 @@ TEST_F(BookmarkBarControllerTest, TestFolders) {
// click on a folder folder menus should show until another click on a folder
// button, and a click outside the bar and its folder menus.
TEST_F(BookmarkBarControllerTest, TestFolderButtons) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b 4f:[ 4f1b 4f2b ] ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -1350,7 +1350,7 @@ TEST_F(BookmarkBarControllerTest, OffTheSideFolder) {
EXPECT_TRUE([bar_ offTheSideButtonIsHidden]);
// Create some buttons.
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* parent = model->bookmark_bar_node();
for (int x = 0; x < 30; x++) {
model->AddURL(parent, parent->child_count(),
@@ -1429,7 +1429,7 @@ TEST_F(BookmarkBarControllerTest, EventToExitCheck) {
TEST_F(BookmarkBarControllerTest, DropDestination) {
// Make some buttons.
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* parent = model->bookmark_bar_node();
model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 1"));
model->AddFolder(parent, parent->child_count(), ASCIIToUTF16("folder 2"));
@@ -1467,7 +1467,7 @@ TEST_F(BookmarkBarControllerTest, DropDestination) {
}
TEST_F(BookmarkBarControllerTest, CloseFolderOnAnimate) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
[bar_ setStateAnimationsEnabled:YES];
const BookmarkNode* parent = model->bookmark_bar_node();
const BookmarkNode* folder = model->AddFolder(parent,
@@ -1505,7 +1505,7 @@ TEST_F(BookmarkBarControllerTest, CloseFolderOnAnimate) {
}
TEST_F(BookmarkBarControllerTest, MoveRemoveAddButtons) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -1587,7 +1587,7 @@ TEST_F(BookmarkBarControllerTest, DISABLED_LastBookmarkResizeBehavior) {
ASSERT_TRUE([bar_ appsPageShortcutButtonIsHidden]);
// Add three buttons to the bookmark bar.
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -1666,7 +1666,7 @@ TEST_F(BookmarkBarControllerTest, DISABLED_LastBookmarkResizeBehavior) {
}
TEST_F(BookmarkBarControllerTest, BookmarksWithAppsPageShortcut) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -1753,7 +1753,8 @@ public:
frame.origin.y = 100;
[[[bar_ view] superview] setFrame:frame];
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model =
+ BookmarkModelFactory::GetForBrowserContext(profile());
parent_ = model->bookmark_bar_node();
// { one, { two-one, two-two }, three }
model->AddURL(parent_, parent_->child_count(), ASCIIToUTF16("title"),
@@ -1878,7 +1879,7 @@ class BookmarkBarControllerDragDropTest : public BookmarkBarControllerTestBase {
};
TEST_F(BookmarkBarControllerDragDropTest, DragMoveBarBookmarkToOffTheSide) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1bWithLongName 2fWithLongName:[ "
"2f1bWithLongName 2f2fWithLongName:[ 2f2f1bWithLongName "
@@ -1930,7 +1931,7 @@ TEST_F(BookmarkBarControllerDragDropTest, DragMoveBarBookmarkToOffTheSide) {
}
TEST_F(BookmarkBarControllerDragDropTest, DragOffTheSideToOther) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1bWithLongName 2bWithLongName "
"3bWithLongName 4bWithLongName 5bWithLongName 6bWithLongName "
@@ -1987,7 +1988,7 @@ TEST_F(BookmarkBarControllerDragDropTest, DragOffTheSideToOther) {
}
TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkData) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b ");
@@ -2047,7 +2048,7 @@ TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkData) {
}
TEST_F(BookmarkBarControllerDragDropTest, AddURLs) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b ");
@@ -2079,7 +2080,7 @@ TEST_F(BookmarkBarControllerDragDropTest, AddURLs) {
}
TEST_F(BookmarkBarControllerDragDropTest, ControllerForNode) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -2095,7 +2096,7 @@ TEST_F(BookmarkBarControllerDragDropTest, ControllerForNode) {
}
TEST_F(BookmarkBarControllerDragDropTest, DropPositionIndicator) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b 2f3b ] 3b 4b ");
bookmarks::test::AddNodesFromModelString(model, root, model_string);
@@ -2134,7 +2135,7 @@ TEST_F(BookmarkBarControllerDragDropTest, DropPositionIndicator) {
}
TEST_F(BookmarkBarControllerDragDropTest, PulseButton) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
GURL gurl("http://www.google.com");
const BookmarkNode* node = model->AddURL(root, root->child_count(),
@@ -2178,7 +2179,7 @@ TEST_F(BookmarkBarControllerDragDropTest, PulseButton) {
}
TEST_F(BookmarkBarControllerDragDropTest, DragBookmarkDataToTrash) {
- BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
+ BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile());
const BookmarkNode* root = model->bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b ");

Powered by Google App Engine
This is Rietveld 408576698