diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 02:01:08 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-24 02:01:08 +0000 |
commit | cb26fb7252e6839b7465de9ce0aec64f321a4851 (patch) | |
tree | 287fa98b14126ce7e32a0d1c138125e36135da67 /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | |
parent | 0790ab29d8b09d8c737ecd976822f794223b2847 (diff) | |
download | chromium_src-cb26fb7252e6839b7465de9ce0aec64f321a4851.zip chromium_src-cb26fb7252e6839b7465de9ce0aec64f321a4851.tar.gz chromium_src-cb26fb7252e6839b7465de9ce0aec64f321a4851.tar.bz2 |
[Mac] Make bookmark bar primitive drag destination.
Credits for the bookmark bar fix to dmac; stolen from http://codereview.chromium.org/267082 .
BUG=18289
TEST=Drag a link or bookmarklet from the web to the bookmark bar. It should be added at the end of the bar.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=29906
Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=29908
Review URL: http://codereview.chromium.org/336001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29990 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 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 985e96f..11dc3fd 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -6,6 +6,7 @@ #include "base/basictypes.h" #include "base/scoped_nsobject.h" +#include "base/sys_string_conversions.h" #import "chrome/browser/cocoa/bookmark_bar_constants.h" #import "chrome/browser/cocoa/bookmark_bar_controller.h" #import "chrome/browser/cocoa/bookmark_bar_view.h" @@ -669,6 +670,37 @@ TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) { } } +TEST_F(BookmarkBarControllerTest, DropBookmarks) { + const char* urls[] = { + "http://qwantz.com", + "http://xkcd.com", + "javascript:alert('lolwut')" + }; + std::wstring titles[] = { + std::wstring(L"Philosophoraptor"), + std::wstring(L"Can't draw"), + std::wstring(L"Inspiration") + }; + EXPECT_EQ(arraysize(urls), arraysize(titles)); + + NSMutableArray* nsurls = [NSMutableArray arrayWithCapacity:0]; + NSMutableArray* nstitles = [NSMutableArray arrayWithCapacity:0]; + for (size_t i = 0; i < arraysize(urls); ++i) { + [nsurls addObject:[NSString stringWithCString:urls[i]]]; + [nstitles addObject:base::SysWideToNSString(titles[i])]; + } + + BookmarkModel* model = helper_.profile()->GetBookmarkModel(); + const BookmarkNode* parent = model->GetBookmarkBarNode(); + [bar_ addURLs:nsurls withTitles:nstitles at:NSZeroPoint]; + EXPECT_EQ(3, parent->GetChildCount()); + for (int i = 0; i < parent->GetChildCount(); ++i) { + EXPECT_EQ(parent->GetChild(i)->GetURL(), GURL(urls[i])); + EXPECT_EQ(parent->GetChild(i)->GetTitle(), titles[i]); + } +} + + // Cannot test these methods since they simply call a single static // method, BookmarkEditor::Show(), which is impossible to mock. // editBookmark:, addPage: |