diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 20:03:46 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 20:03:46 +0000 |
commit | c5e401ad5812699fafaf41492015eb26174084ed (patch) | |
tree | b047de1031abbb105f75ae2e69f1d7c69a19e568 /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | |
parent | 743de20e45734ce593a229801849e25b231785a8 (diff) | |
download | chromium_src-c5e401ad5812699fafaf41492015eb26174084ed.zip chromium_src-c5e401ad5812699fafaf41492015eb26174084ed.tar.gz chromium_src-c5e401ad5812699fafaf41492015eb26174084ed.tar.bz2 |
Dragging a file from desktop to bookmark bar should now create a bookmark.
BUG=37419
TEST=Dragging a file from desktop to bookmark bar --> creates a bookmark.
Dragging a link from content area to bookmark bar --> creates a bookmark.
Review URL: http://codereview.chromium.org/1504002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42983 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 | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index ae1c35e..da9cfc3 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -916,17 +916,19 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) { const char* urls[] = { "http://qwantz.com", "http://xkcd.com", - "javascript:alert('lolwut')" + "javascript:alert('lolwut')", + "/tmp/local-file.txt" // As if dragged from the desktop. }; std::wstring titles[] = { std::wstring(L"Philosophoraptor"), std::wstring(L"Can't draw"), - std::wstring(L"Inspiration") + std::wstring(L"Inspiration"), + std::wstring(L"Frum stuf") }; EXPECT_EQ(arraysize(urls), arraysize(titles)); - NSMutableArray* nsurls = [NSMutableArray arrayWithCapacity:0]; - NSMutableArray* nstitles = [NSMutableArray arrayWithCapacity:0]; + NSMutableArray* nsurls = [NSMutableArray array]; + NSMutableArray* nstitles = [NSMutableArray array]; for (size_t i = 0; i < arraysize(urls); ++i) { [nsurls addObject:base::SysUTF8ToNSString(urls[i])]; [nstitles addObject:base::SysWideToNSString(titles[i])]; @@ -935,9 +937,18 @@ TEST_F(BookmarkBarControllerTest, DropBookmarks) { BookmarkModel* model = helper_.profile()->GetBookmarkModel(); const BookmarkNode* parent = model->GetBookmarkBarNode(); [bar_ addURLs:nsurls withTitles:nstitles at:NSZeroPoint]; - EXPECT_EQ(3, parent->GetChildCount()); + EXPECT_EQ(4, parent->GetChildCount()); for (int i = 0; i < parent->GetChildCount(); ++i) { - EXPECT_EQ(parent->GetChild(i)->GetURL(), GURL(urls[i])); + GURL gurl = parent->GetChild(i)->GetURL(); + if (gurl.scheme() == "http" || + gurl.scheme() == "javascript") { + EXPECT_EQ(parent->GetChild(i)->GetURL(), GURL(urls[i])); + } else { + // Be flexible if the scheme needed to be added. + std::string gurl_string = gurl.spec(); + std::string my_string = parent->GetChild(i)->GetURL().spec(); + EXPECT_NE(gurl_string.find(my_string), std::string::npos); + } EXPECT_EQ(parent->GetChild(i)->GetTitle(), titles[i]); } } |