diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 05:21:35 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 05:21:35 +0000 |
commit | 4e187ef6569e197a6fd446fa5c2733ae7f0138b4 (patch) | |
tree | 2e0dff2c70620acb5ee575af258c5d7d957dac3e /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | |
parent | fd8035dceb5e77948e10f4fd2d954916fc7800cc (diff) | |
download | chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.zip chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.tar.gz chromium_src-4e187ef6569e197a6fd446fa5c2733ae7f0138b4.tar.bz2 |
Add bookmark copying while dragging by holding down the <option> key.
BUG=35969
TEST=Hold down the <option> key while dragging a bookmark to a new location. Repeat with the following: 1) From bookmark bar to bookmark bar, 2) from bookmark bar into a folder, 3) from within a folder to a different place within the same folder, 4) from within a folder to the bookmark bar, 5) from within a folder to a different folder. Check to insure that the original bookmark (and its contents if it was a folder) are in both the original location and the new location.
Review URL: http://codereview.chromium.org/790001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41252 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.mm | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 9b08e90..a6fe547 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -901,21 +901,57 @@ TEST_F(BookmarkBarControllerTest, TestDragButton) { 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)]; + [bar_ dragButton:[[bar_ buttons] objectAtIndex:2] + to:NSMakePoint(0, 0) + copy:NO]; EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"c"]); + // Make sure a 'copy' did not happen. + EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); - [bar_ dragButton:[[bar_ buttons] objectAtIndex:1] to:NSMakePoint(1000, 0)]; + [bar_ dragButton:[[bar_ buttons] objectAtIndex:1] + to:NSMakePoint(1000, 0) + copy:NO]; 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"]); + EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); // 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)]; + [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] + to:NSMakePoint(x, 0) + copy:NO]; 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"]); + EXPECT_EQ([[bar_ buttons] count], arraysize(titles)); +} + +TEST_F(BookmarkBarControllerTest, TestCopyButton) { + 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"]); + + // Drag 'a' between 'b' and 'c'. + CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]); + x += [[bar_ view] frame].origin.x; + [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] + to:NSMakePoint(x, 0) + copy:YES]; + EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"a"]); + EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"b"]); + EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]); + EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:3] title] isEqual:@"c"]); + EXPECT_EQ([[bar_ buttons] count], 4U); } // Fake a theme with colored text. Apply it and make sure bookmark |