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

Unified Diff: chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm

Issue 340042: bookmark STAR bubble: Disambiguate folders with the same name... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm (revision 30683)
+++ chrome/browser/cocoa/bookmark_bubble_controller_unittest.mm (working copy)
@@ -79,7 +79,8 @@
// Returns a controller but ownership not transferred.
// Only one of these will be valid at a time.
BookmarkBubbleController* ControllerForNode(const BookmarkNode* node) {
- DCHECK(controller_ == nil);
+ if (controller_)
+ [controller_ close];
controller_ = [[BookmarkBubbleController alloc]
initWithDelegate:delegate_.get()
parentWindow:test_window()
@@ -196,6 +197,31 @@
EXPECT_EQ(node->GetParent()->GetTitle(), L"grandma");
}
+// Confirm happiness with parent nodes that have the same name.
+TEST_F(BookmarkBubbleControllerTest, TestNewParentSameName) {
+ for (int i=0; i<2; i++) {
+ BookmarkModel* model = GetBookmarkModel();
+ const BookmarkNode* node = model->AddURL(model->GetBookmarkBarNode(),
+ 0,
+ L"short-title",
+ GURL("http://www.google.com"));
+ model->AddGroup(model->GetBookmarkBarNode(), 0, L"NAME");
+ model->AddGroup(model->GetBookmarkBarNode(), 0, L"NAME");
+ model->AddGroup(model->GetBookmarkBarNode(), 0, L"NAME");
+ BookmarkBubbleController* controller = ControllerForNode(node);
+ EXPECT_TRUE(controller);
+
+ // simulate a user edit
+ [controller setParentFolderSelection:
+ model->GetBookmarkBarNode()->GetChild(i)];
+ [controller edit:controller];
+
+ // Make sure bookmark has changed, and that the parent is what we
+ // expect. This proves nobody did searching based on name.
+ EXPECT_EQ(node->GetParent(), model->GetBookmarkBarNode()->GetChild(i));
+ }
+}
+
// Click the "remove" button
TEST_F(BookmarkBubbleControllerTest, TestRemove) {
BookmarkModel* model = GetBookmarkModel();
« no previous file with comments | « chrome/browser/cocoa/bookmark_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698