summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 17:59:10 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 17:59:10 +0000
commit52c71ed5a093463acb72598dc8b07a35fbb49842 (patch)
tree7e1705718bed27cdd1068dacb06176da3fb5b531 /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
parent1308459ce571eccb2b344f35ca0e4bf750be9395 (diff)
downloadchromium_src-52c71ed5a093463acb72598dc8b07a35fbb49842.zip
chromium_src-52c71ed5a093463acb72598dc8b07a35fbb49842.tar.gz
chromium_src-52c71ed5a093463acb72598dc8b07a35fbb49842.tar.bz2
Drag and drop of buttons/folders from bar to bar.
Does not include DnD to/from menus. No animations of drop destination yet. BUG=http://crbug.com/17608 TEST=Do some draggin and droppin. Confirm click still works on the marks and folders. Confirm "other bookmarks" canNOT be moved. Confirm NTP / detached bar also works for DnD. Review URL: http://codereview.chromium.org/395031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_controller_unittest.mm')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller_unittest.mm33
1 files changed, 32 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
index 7433bf2..c025b0e 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
@@ -63,7 +63,7 @@
// Remember the number of times we've gotten a frameDidChange notification.
@interface BookmarkBarControllerTogglePong : BookmarkBarControllerNoOpen {
-@private
+ @private
int toggles_;
}
@property (readonly) int toggles;
@@ -758,4 +758,35 @@ TEST_F(BookmarkBarControllerTest, TestMenuNodeAndDisable) {
EXPECT_TRUE([bar_ validateUserInterfaceItem:item]);
}
+TEST_F(BookmarkBarControllerTest, TestDragButton) {
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+
+ GURL gurls[] = { GURL("http://www.google.com/a"),
+ GURL("http://www.google.com/b"),
+ GURL("http://www.google.com/c") };
+ std::wstring titles[] = { L"a", L"b", L"c" };
+ for (unsigned i = 0; i < arraysize(titles); i++) {
+ model->SetURLStarred(gurls[i], titles[i], true);
+ }
+
+ EXPECT_EQ([[bar_ buttons] count], arraysize(titles));
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"a"]);
+
+ [bar_ dragButton:[[bar_ buttons] objectAtIndex:2] to:NSMakePoint(0, 0)];
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"c"]);
+
+ [bar_ dragButton:[[bar_ buttons] objectAtIndex:1] to:NSMakePoint(1000, 0)];
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"c"]);
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"b"]);
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]);
+
+ // Finally, a drop of the 1st between the next 2
+ CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]);
+ x += [[bar_ view] frame].origin.x;
+ [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] to:NSMakePoint(x, 0)];
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"b"]);
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"c"]);
+ EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]);
+}
+
} // namespace