summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 17:51:35 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 17:51:35 +0000
commitf4471c57c0d9df0dcbf4bc1b88c69ae1867c4042 (patch)
tree972bcd3cd909f08fdeec22e9831458d32a88d4d5 /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
parente9d71884e97fd3484f2aad0b6f7562e3f86a1616 (diff)
downloadchromium_src-f4471c57c0d9df0dcbf4bc1b88c69ae1867c4042.zip
chromium_src-f4471c57c0d9df0dcbf4bc1b88c69ae1867c4042.tar.gz
chromium_src-f4471c57c0d9df0dcbf4bc1b88c69ae1867c4042.tar.bz2
[Mac] Make bookmark bar primitive drag destination.
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. Review URL: http://codereview.chromium.org/336001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29906 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, 33 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..be96e60 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,38 @@ TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) {
}
}
+TEST_F(BookmarkBarControllerTest, DropBookmarks) {
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+ const BookmarkNode* parent = model->GetBookmarkBarNode();
+
+ 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])];
+ }
+
+ [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: