Commit 331304b6 authored by rlp@chromium.org's avatar rlp@chromium.org

Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS.

BUG=112525

Review URL: https://chromiumcodereview.appspot.com/10834161

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150140 0039d316-1c4b-4281-b951-d872f2087c98
parent 0462d471
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import "base/memory/scoped_nsobject.h" #import "base/memory/scoped_nsobject.h"
#import "chrome/browser/app_controller_mac.h" #import "chrome/browser/app_controller_mac.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list.h"
...@@ -76,7 +77,7 @@ ...@@ -76,7 +77,7 @@
return nil; return nil;
} }
BookmarkModel* model = lastProfile->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile);
if (!model->IsLoaded()) { if (!model->IsLoaded()) {
AppleScript::SetError(AppleScript::errBookmarkModelLoad); AppleScript::SetError(AppleScript::errBookmarkModelLoad);
return nil; return nil;
...@@ -99,7 +100,7 @@ ...@@ -99,7 +100,7 @@
return nil; return nil;
} }
BookmarkModel* model = lastProfile->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(lastProfile);
if (!model->IsLoaded()) { if (!model->IsLoaded()) {
AppleScript::SetError(AppleScript::errBookmarkModelLoad); AppleScript::SetError(AppleScript::errBookmarkModelLoad);
return NULL; return NULL;
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h"
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -39,7 +40,7 @@ class BookmarkAllTabsControllerTest : public CocoaProfileTest { ...@@ -39,7 +40,7 @@ class BookmarkAllTabsControllerTest : public CocoaProfileTest {
const BookmarkNode* folder_a_; const BookmarkNode* folder_a_;
void CreateModel() { void CreateModel() {
BookmarkModel& model(*(profile()->GetBookmarkModel())); BookmarkModel& model(*(BookmarkModelFactory::GetForProfile(profile())));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
folder_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a")); folder_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a"));
model.AddURL(folder_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com")); model.AddURL(folder_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com"));
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_nsobject.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/animation_utils.h" #import "chrome/browser/ui/cocoa/animation_utils.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
...@@ -134,7 +135,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest { ...@@ -134,7 +135,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest {
} }
void CreateModel() { void CreateModel() {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
const BookmarkNode* folderA = model->AddFolder(parent, const BookmarkNode* folderA = model->AddFolder(parent,
parent->child_count(), parent->child_count(),
...@@ -178,7 +179,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest { ...@@ -178,7 +179,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest {
// Remove the bookmark with the long title. // Remove the bookmark with the long title.
void RemoveLongTitleNode() { void RemoveLongTitleNode() {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
model->Remove(longTitleNode_->parent(), model->Remove(longTitleNode_->parent(),
longTitleNode_->parent()->GetIndexOf(longTitleNode_)); longTitleNode_->parent()->GetIndexOf(longTitleNode_));
} }
...@@ -186,7 +187,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest { ...@@ -186,7 +187,7 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest {
// Add LOTS of nodes to our model if needed (e.g. scrolling). // Add LOTS of nodes to our model if needed (e.g. scrolling).
// Returns the number of nodes added. // Returns the number of nodes added.
int AddLotsOfNodes() { int AddLotsOfNodes() {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
for (int i = 0; i < kLotsOfNodesCount; i++) { for (int i = 0; i < kLotsOfNodesCount; i++) {
model->AddURL(folderA_, folderA_->child_count(), model->AddURL(folderA_, folderA_->child_count(),
ASCIIToUTF16("repeated title"), ASCIIToUTF16("repeated title"),
...@@ -295,7 +296,7 @@ TEST_F(BookmarkBarFolderControllerTest, BasicPosition) { ...@@ -295,7 +296,7 @@ TEST_F(BookmarkBarFolderControllerTest, BasicPosition) {
// Confirm we grow right until end of screen, then start growing left // Confirm we grow right until end of screen, then start growing left
// until end of screen again, then right. // until end of screen again, then right.
TEST_F(BookmarkBarFolderControllerTest, PositionRightLeftRight) { TEST_F(BookmarkBarFolderControllerTest, PositionRightLeftRight) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
const BookmarkNode* folder = parent; const BookmarkNode* folder = parent;
...@@ -695,7 +696,7 @@ class BookmarkBarFolderControllerMenuTest : public CocoaProfileTest { ...@@ -695,7 +696,7 @@ class BookmarkBarFolderControllerMenuTest : public CocoaProfileTest {
TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToFolder) { TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToFolder) {
WithNoAnimation at_all; WithNoAnimation at_all;
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -768,7 +769,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToFolder) { ...@@ -768,7 +769,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToFolder) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragCopyBarBookmarkToFolder) { TEST_F(BookmarkBarFolderControllerMenuTest, DragCopyBarBookmarkToFolder) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -832,7 +833,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragCopyBarBookmarkToFolder) { ...@@ -832,7 +833,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragCopyBarBookmarkToFolder) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) { TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -897,7 +898,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) { ...@@ -897,7 +898,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveBarBookmarkToSubfolder) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveWithinFolder) { TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveWithinFolder) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -946,7 +947,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveWithinFolder) { ...@@ -946,7 +947,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveWithinFolder) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragParentOntoChild) { TEST_F(BookmarkBarFolderControllerMenuTest, DragParentOntoChild) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -983,7 +984,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragParentOntoChild) { ...@@ -983,7 +984,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragParentOntoChild) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveChildToParent) { TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveChildToParent) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b "
"2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b " "2f2f3b ] 2f3b ] 3b 4f:[ 4f1f:[ 4f1f1b 4f1f2b 4f1f3b ] 4f2f:[ 4f2f1b "
...@@ -1035,7 +1036,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveChildToParent) { ...@@ -1035,7 +1036,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragMoveChildToParent) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragWindowResizing) { TEST_F(BookmarkBarFolderControllerMenuTest, DragWindowResizing) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string const std::string
model_string("a b:[ b1 b2 b3 ] reallyReallyLongBookmarkName c "); model_string("a b:[ b1 b2 b3 ] reallyReallyLongBookmarkName c ");
...@@ -1075,7 +1076,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragWindowResizing) { ...@@ -1075,7 +1076,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragWindowResizing) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, MoveRemoveAddButtons) { TEST_F(BookmarkBarFolderControllerMenuTest, MoveRemoveAddButtons) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b 2f3b ] 3b 4b "); const std::string model_string("1b 2f:[ 2f1b 2f2b 2f3b ] 3b 4b ");
model_test_utils::AddNodesFromModelString(model, root, model_string); model_test_utils::AddNodesFromModelString(model, root, model_string);
...@@ -1138,7 +1139,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, MoveRemoveAddButtons) { ...@@ -1138,7 +1139,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, MoveRemoveAddButtons) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, ControllerForNode) { TEST_F(BookmarkBarFolderControllerMenuTest, ControllerForNode) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b "); const std::string model_string("1b 2f:[ 2f1b 2f2b ] 3b ");
model_test_utils::AddNodesFromModelString(model, root, model_string); model_test_utils::AddNodesFromModelString(model, root, model_string);
...@@ -1173,7 +1174,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, ControllerForNode) { ...@@ -1173,7 +1174,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, ControllerForNode) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, MenuSizingAndScrollArrows) { TEST_F(BookmarkBarFolderControllerMenuTest, MenuSizingAndScrollArrows) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2b 3b "); const std::string model_string("1b 2b 3b ");
model_test_utils::AddNodesFromModelString(model, root, model_string); model_test_utils::AddNodesFromModelString(model, root, model_string);
...@@ -1268,7 +1269,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, MenuSizingAndScrollArrows) { ...@@ -1268,7 +1269,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, MenuSizingAndScrollArrows) {
// See http://crbug.com/46101 // See http://crbug.com/46101
TEST_F(BookmarkBarFolderControllerMenuTest, HoverThenDeleteBookmark) { TEST_F(BookmarkBarFolderControllerMenuTest, HoverThenDeleteBookmark) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const BookmarkNode* folder = model.AddFolder(root, const BookmarkNode* folder = model.AddFolder(root,
root->child_count(), root->child_count(),
...@@ -1334,7 +1335,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, HoverThenDeleteBookmark) { ...@@ -1334,7 +1335,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, HoverThenDeleteBookmark) {
@end @end
TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkData) { TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkData) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b "); "2f3b ] 3b 4b ");
...@@ -1395,7 +1396,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkData) { ...@@ -1395,7 +1396,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkData) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkDataToTrash) { TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkDataToTrash) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b "); "2f3b ] 3b 4b ");
...@@ -1437,7 +1438,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkDataToTrash) { ...@@ -1437,7 +1438,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, DragBookmarkDataToTrash) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, AddURLs) { TEST_F(BookmarkBarFolderControllerMenuTest, AddURLs) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b "); "2f3b ] 3b 4b ");
...@@ -1482,7 +1483,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, AddURLs) { ...@@ -1482,7 +1483,7 @@ TEST_F(BookmarkBarFolderControllerMenuTest, AddURLs) {
} }
TEST_F(BookmarkBarFolderControllerMenuTest, DropPositionIndicator) { TEST_F(BookmarkBarFolderControllerMenuTest, DropPositionIndicator) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b 2f2f3b ] "
"2f3b ] 3b 4b "); "2f3b ] 3b 4b ");
...@@ -1541,7 +1542,7 @@ class BookmarkBarFolderControllerClosingTest : public ...@@ -1541,7 +1542,7 @@ class BookmarkBarFolderControllerClosingTest : public
}; };
TEST_F(BookmarkBarFolderControllerClosingTest, DeleteClosesFolder) { TEST_F(BookmarkBarFolderControllerClosingTest, DeleteClosesFolder) {
BookmarkModel& model(*profile()->GetBookmarkModel()); BookmarkModel& model(*BookmarkModelFactory::GetForProfile(profile()));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b ] " const std::string model_string("1b 2f:[ 2f1b 2f2f:[ 2f2f1b 2f2f2b ] "
"2f3b ] 3b "); "2f3b ] 3b ");
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/string16.h" #include "base/string16.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h"
...@@ -59,8 +60,8 @@ class BookmarkBarFolderViewTest : public CocoaProfileTest { ...@@ -59,8 +60,8 @@ class BookmarkBarFolderViewTest : public CocoaProfileTest {
view_.reset([[BookmarkBarFolderView alloc] init]); view_.reset([[BookmarkBarFolderView alloc] init]);
mock_controller_.reset(GetMockController(YES, mock_controller_.reset(GetMockController(
profile()->GetBookmarkModel())); YES, BookmarkModelFactory::GetForProfile(profile())));
mock_button_.reset(GetMockButton(mock_controller_.get())); mock_button_.reset(GetMockButton(mock_controller_.get()));
[view_ awakeFromNib]; [view_ awakeFromNib];
...@@ -118,7 +119,8 @@ class BookmarkBarFolderViewTest : public CocoaProfileTest { ...@@ -118,7 +119,8 @@ class BookmarkBarFolderViewTest : public CocoaProfileTest {
} }
id GetMockButton(id mock_controller) { id GetMockButton(id mock_controller) {
BookmarkModel* bookmark_model = profile()->GetBookmarkModel(); BookmarkModel* bookmark_model =
BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* node = const BookmarkNode* node =
bookmark_model->AddURL(bookmark_model->bookmark_bar_node(), bookmark_model->AddURL(bookmark_model->bookmark_bar_node(),
0, 0,
...@@ -156,8 +158,8 @@ TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDragAndDropAcrossProfiles) { ...@@ -156,8 +158,8 @@ TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDragAndDropAcrossProfiles) {
other_profile->CreateBookmarkModel(true); other_profile->CreateBookmarkModel(true);
other_profile->BlockUntilBookmarkModelLoaded(); other_profile->BlockUntilBookmarkModelLoaded();
mock_controller_.reset(GetMockController(YES, mock_controller_.reset(GetMockController(
other_profile->GetBookmarkModel())); YES, BookmarkModelFactory::GetForProfile(other_profile)));
[view_ setController:mock_controller_]; [view_ setController:mock_controller_];
id drag_info = GetFakeDragInfoForType(kBookmarkButtonDragType); id drag_info = GetFakeDragInfoForType(kBookmarkButtonDragType);
...@@ -196,7 +198,8 @@ TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDropIndicator) { ...@@ -196,7 +198,8 @@ TEST_F(BookmarkBarFolderViewTest, BookmarkButtonDropIndicator) {
[mock_controller_ verify]; [mock_controller_ verify];
EXPECT_TRUE([view_ dropIndicatorShown]); EXPECT_TRUE([view_ dropIndicatorShown]);
EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos); EXPECT_EQ([view_ dropIndicatorPosition], kFakeIndicatorPos);
mock_controller_.reset(GetMockController(NO, profile()->GetBookmarkModel())); mock_controller_.reset(GetMockController(
NO, BookmarkModelFactory::GetForProfile(profile())));
[view_ setController:mock_controller_]; [view_ setController:mock_controller_];
[[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone] [[[mock_controller_ expect] andReturnUnsignedInteger:NSDragOperationNone]
draggingEntered:drag_info]; draggingEntered:drag_info];
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h"
...@@ -297,7 +298,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { ...@@ -297,7 +298,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver {
#pragma mark Folder Tree Management #pragma mark Folder Tree Management
- (BookmarkModel*)bookmarkModel { - (BookmarkModel*)bookmarkModel {
return profile_->GetBookmarkModel(); return BookmarkModelFactory::GetForProfile(profile_);
} }
- (Profile*)profile { - (Profile*)profile {
...@@ -436,7 +437,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { ...@@ -436,7 +437,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver {
// of ancestor nodes. Then crawl down the folderTreeArray looking // of ancestor nodes. Then crawl down the folderTreeArray looking
// for each ancestor in order while building up the selectionPath. // for each ancestor in order while building up the selectionPath.
std::stack<const BookmarkNode*> nodeStack; std::stack<const BookmarkNode*> nodeStack;
BookmarkModel* model = profile_->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
const BookmarkNode* rootNode = model->root_node(); const BookmarkNode* rootNode = model->root_node();
const BookmarkNode* node = desiredNode; const BookmarkNode* node = desiredNode;
while (node != rootNode) { while (node != rootNode) {
...@@ -491,7 +492,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { ...@@ -491,7 +492,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver {
- (void)buildFolderTree { - (void)buildFolderTree {
// Build up a tree of the current folder configuration. // Build up a tree of the current folder configuration.
BookmarkModel* model = profile_->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
const BookmarkNode* rootNode = model->root_node(); const BookmarkNode* rootNode = model->root_node();
NSMutableArray* baseArray = [self addChildFoldersFromNode:rootNode]; NSMutableArray* baseArray = [self addChildFoldersFromNode:rootNode];
DCHECK(baseArray); DCHECK(baseArray);
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.h"
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -26,7 +27,7 @@ class BookmarkEditorControllerTest : public CocoaProfileTest { ...@@ -26,7 +27,7 @@ class BookmarkEditorControllerTest : public CocoaProfileTest {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
ASSERT_TRUE(profile()); ASSERT_TRUE(profile());
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
default_parent_ = model->bookmark_bar_node(); default_parent_ = model->bookmark_bar_node();
default_name_ = "http://www.zim-bop-a-dee.com/"; default_name_ = "http://www.zim-bop-a-dee.com/";
default_title_ = ASCIIToUTF16("ooh title"); default_title_ = ASCIIToUTF16("ooh title");
...@@ -89,7 +90,7 @@ TEST_F(BookmarkEditorControllerTest, EditAndFixPrefix) { ...@@ -89,7 +90,7 @@ TEST_F(BookmarkEditorControllerTest, EditAndFixPrefix) {
TEST_F(BookmarkEditorControllerTest, NodeDeleted) { TEST_F(BookmarkEditorControllerTest, NodeDeleted) {
// Delete the bookmark being edited and verify the sheet cancels itself: // Delete the bookmark being edited and verify the sheet cancels itself:
ASSERT_TRUE([test_window() attachedSheet]); ASSERT_TRUE([test_window() attachedSheet]);
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
model->Remove(default_parent_, 0); model->Remove(default_parent_, 0);
ASSERT_FALSE([test_window() attachedSheet]); ASSERT_FALSE([test_window() attachedSheet]);
} }
...@@ -140,7 +141,7 @@ class BookmarkEditorControllerNoNodeTest : public CocoaProfileTest { ...@@ -140,7 +141,7 @@ class BookmarkEditorControllerNoNodeTest : public CocoaProfileTest {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
ASSERT_TRUE(profile()); ASSERT_TRUE(profile());
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
controller_ = [[BookmarkEditorController alloc] controller_ = [[BookmarkEditorController alloc]
initWithParentWindow:test_window() initWithParentWindow:test_window()
...@@ -177,7 +178,7 @@ class BookmarkEditorControllerYesNodeTest : public CocoaProfileTest { ...@@ -177,7 +178,7 @@ class BookmarkEditorControllerYesNodeTest : public CocoaProfileTest {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
ASSERT_TRUE(profile()); ASSERT_TRUE(profile());
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
default_title_ = ASCIIToUTF16("wooh title"); default_title_ = ASCIIToUTF16("wooh title");
url_name_ = "http://www.zoom-baby-doo-da.com/"; url_name_ = "http://www.zoom-baby-doo-da.com/";
...@@ -233,7 +234,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest { ...@@ -233,7 +234,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest {
// bb-4 // bb-4
// b-1 // b-1
// b-2 // b-2
BookmarkModel& model(*(profile()->GetBookmarkModel())); BookmarkModel& model(*(BookmarkModelFactory::GetForProfile(profile())));
const BookmarkNode* root = model.bookmark_bar_node(); const BookmarkNode* root = model.bookmark_bar_node();
folder_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a")); folder_a_ = model.AddFolder(root, 0, ASCIIToUTF16("a"));
model.AddURL(folder_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com")); model.AddURL(folder_a_, 0, ASCIIToUTF16("a-0"), GURL("http://a-0.com"));
...@@ -299,7 +300,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest { ...@@ -299,7 +300,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest {
// bookmark_bb_3_ so that it points to the new node for testing. // bookmark_bb_3_ so that it points to the new node for testing.
void UpdateBB3() { void UpdateBB3() {
std::vector<const BookmarkNode*> nodes; std::vector<const BookmarkNode*> nodes;
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
model->GetNodesByURL(bb3_url_1_, &nodes); model->GetNodesByURL(bb3_url_1_, &nodes);
if (nodes.empty()) if (nodes.empty())
model->GetNodesByURL(bb3_url_2_, &nodes); model->GetNodesByURL(bb3_url_2_, &nodes);
...@@ -310,7 +311,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest { ...@@ -310,7 +311,7 @@ class BookmarkEditorControllerTreeTest : public CocoaProfileTest {
}; };
TEST_F(BookmarkEditorControllerTreeTest, VerifyBookmarkTestModel) { TEST_F(BookmarkEditorControllerTreeTest, VerifyBookmarkTestModel) {
BookmarkModel& model(*(profile()->GetBookmarkModel())); BookmarkModel& model(*(BookmarkModelFactory::GetForProfile(profile())));
model.root_node(); model.root_node();
const BookmarkNode& root(*model.bookmark_bar_node()); const BookmarkNode& root(*model.bookmark_bar_node());
EXPECT_EQ(4, root.child_count()); EXPECT_EQ(4, root.child_count());
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
#include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" #include "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
...@@ -35,7 +36,7 @@ class BookmarkFolderTargetTest : public CocoaProfileTest { ...@@ -35,7 +36,7 @@ class BookmarkFolderTargetTest : public CocoaProfileTest {
CocoaProfileTest::SetUp(); CocoaProfileTest::SetUp();
ASSERT_TRUE(profile()); ASSERT_TRUE(profile());
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
bmbNode_ = model->bookmark_bar_node(); bmbNode_ = model->bookmark_bar_node();
} }
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h"
#import "chrome/browser/ui/cocoa/cocoa_profile_test.h" #import "chrome/browser/ui/cocoa/cocoa_profile_test.h"
...@@ -30,7 +31,7 @@ class BookmarkModelObserverForCocoaTest : public CocoaProfileTest { ...@@ -30,7 +31,7 @@ class BookmarkModelObserverForCocoaTest : public CocoaProfileTest {
TEST_F(BookmarkModelObserverForCocoaTest, TestCallback) { TEST_F(BookmarkModelObserverForCocoaTest, TestCallback) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* node = model->AddURL(model->bookmark_bar_node(), const BookmarkNode* node = model->AddURL(model->bookmark_bar_node(),
0, ASCIIToUTF16("super"), 0, ASCIIToUTF16("super"),
GURL("http://www.google.com")); GURL("http://www.google.com"));
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/mac/bundle_locations.h" #include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h"
#include "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h" #include "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h"
...@@ -79,7 +80,7 @@ ...@@ -79,7 +80,7 @@
- (void)runAsModalSheet { - (void)runAsModalSheet {
// Ping me when things change out from under us. // Ping me when things change out from under us.
observer_.reset(new BookmarkModelObserverForCocoa( observer_.reset(new BookmarkModelObserverForCocoa(
node_, profile_->GetBookmarkModel(), node_, BookmarkModelFactory::GetForProfile(profile_),
self, self,
@selector(cancel:))); @selector(cancel:)));
[NSApp beginSheet:[self window] [NSApp beginSheet:[self window]
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
- (IBAction)ok:(id)sender { - (IBAction)ok:(id)sender {
NSString* name = [nameField_ stringValue]; NSString* name = [nameField_ stringValue];
BookmarkModel* model = profile_->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_);
if (node_) { if (node_) {
model->SetTitle(node_, base::SysNSStringToUTF16(name)); model->SetTitle(node_, base::SysNSStringToUTF16(name));
} else { } else {
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_nsobject.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h"
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -18,7 +19,7 @@ class BookmarkNameFolderControllerTest : public CocoaProfileTest { ...@@ -18,7 +19,7 @@ class BookmarkNameFolderControllerTest : public CocoaProfileTest {
// Simple add of a node (at the end). // Simple add of a node (at the end).
TEST_F(BookmarkNameFolderControllerTest, AddNew) { TEST_F(BookmarkNameFolderControllerTest, AddNew) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
EXPECT_EQ(0, parent->child_count()); EXPECT_EQ(0, parent->child_count());
...@@ -48,7 +49,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNew) { ...@@ -48,7 +49,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNew) {
// Add new but specify a sibling. // Add new but specify a sibling.
TEST_F(BookmarkNameFolderControllerTest, AddNewWithSibling) { TEST_F(BookmarkNameFolderControllerTest, AddNewWithSibling) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
// Add 2 nodes. We will place the new folder in the middle of these. // Add 2 nodes. We will place the new folder in the middle of these.
...@@ -78,7 +79,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewWithSibling) { ...@@ -78,7 +79,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewWithSibling) {
// Make sure we are allowed to create a folder named "New Folder". // Make sure we are allowed to create a folder named "New Folder".
TEST_F(BookmarkNameFolderControllerTest, AddNewDefaultName) { TEST_F(BookmarkNameFolderControllerTest, AddNewDefaultName) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
EXPECT_EQ(0, parent->child_count()); EXPECT_EQ(0, parent->child_count());
...@@ -99,7 +100,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewDefaultName) { ...@@ -99,7 +100,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewDefaultName) {
// Make sure we are allowed to create a folder with an empty name. // Make sure we are allowed to create a folder with an empty name.
TEST_F(BookmarkNameFolderControllerTest, AddNewBlankName) { TEST_F(BookmarkNameFolderControllerTest, AddNewBlankName) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
EXPECT_EQ(0, parent->child_count()); EXPECT_EQ(0, parent->child_count());
...@@ -119,7 +120,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewBlankName) { ...@@ -119,7 +120,7 @@ TEST_F(BookmarkNameFolderControllerTest, AddNewBlankName) {
} }
TEST_F(BookmarkNameFolderControllerTest, Rename) { TEST_F(BookmarkNameFolderControllerTest, Rename) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
const BookmarkNode* folder = model->AddFolder(parent, const BookmarkNode* folder = model->AddFolder(parent,
parent->child_count(), parent->child_count(),
...@@ -143,7 +144,7 @@ TEST_F(BookmarkNameFolderControllerTest, Rename) { ...@@ -143,7 +144,7 @@ TEST_F(BookmarkNameFolderControllerTest, Rename) {
} }
TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) { TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) {
BookmarkModel* model = profile()->GetBookmarkModel(); BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
const BookmarkNode* parent = model->bookmark_bar_node(); const BookmarkNode* parent = model->bookmark_bar_node();
EXPECT_EQ(0, parent->child_count()); EXPECT_EQ(0, parent->child_count());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment