summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 21:03:32 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 21:03:32 +0000
commit235f0e34406ee87a0daaeeff2ff420e39ec03753 (patch)
tree36ce5d2db7dde38870aaaba17944403b9a913f44 /chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
parent4593566dcbfd8c2df5f86a4edffb0afb604f87de (diff)
downloadchromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.zip
chromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.tar.gz
chromium_src-235f0e34406ee87a0daaeeff2ff420e39ec03753.tar.bz2
Mac: allow bookmark bar buttons to be dragged as URLs.
TODO #1: dragging of folder buttons. TODO #2: perhaps holding Option while dragging on the bookmark bar should force the bookmark to be copied instead of moved. BUG=17608, 28842 TEST=Make a bunch of (non-folder) bookmarks on the bookmark bar; try dragging these bookmark bar buttons to the desktop, to the web content area, to text boxes, to other browsers -- these should all do sensible things; make sure that dragging them around on the bookmark bar still rearranges them. Review URL: http://codereview.chromium.org/434095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33478 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.mm35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
index 91c9fb4..345b96e 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm
@@ -10,6 +10,7 @@
#import "chrome/browser/cocoa/bookmark_bar_constants.h"
#import "chrome/browser/cocoa/bookmark_bar_controller.h"
#import "chrome/browser/cocoa/bookmark_bar_view.h"
+#import "chrome/browser/cocoa/bookmark_button.h"
#import "chrome/browser/cocoa/bookmark_menu.h"
#include "chrome/browser/cocoa/browser_test_helper.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
@@ -893,6 +894,40 @@ TEST_F(BookmarkBarControllerTest, TestThemedButton) {
}
}
+// Test that delegates and targets of buttons are cleared on dealloc.
+TEST_F(BookmarkBarControllerTest, TestClearOnDealloc) {
+ // Make some bookmark buttons.
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+ GURL gurls[] = { GURL("http://www.foo.com/"),
+ GURL("http://www.bar.com/"),
+ GURL("http://www.baz.com/") };
+ std::wstring titles[] = { L"foo", L"bar", L"baz" };
+ for (size_t i = 0; i < arraysize(titles); i++)
+ model->SetURLStarred(gurls[i], titles[i], true);
+
+ // Get and retain the buttons so we can examine them after dealloc.
+ scoped_nsobject<NSArray> buttons([[bar_ buttons] retain]);
+ EXPECT_EQ([buttons count], arraysize(titles));
+
+ // Make sure that everything is set.
+ for (BookmarkButton* button in buttons.get()) {
+ ASSERT_TRUE([button isKindOfClass:[BookmarkButton class]]);
+ EXPECT_TRUE([button delegate]);
+ EXPECT_TRUE([button target]);
+ EXPECT_TRUE([button action]);
+ }
+
+ // This will dealloc....
+ bar_.reset();
+
+ // Make sure that everything is cleared.
+ for (BookmarkButton* button in buttons.get()) {
+ EXPECT_FALSE([button delegate]);
+ EXPECT_FALSE([button target]);
+ EXPECT_FALSE([button action]);
+ }
+}
+
// TODO(viettrungluu): figure out how to test animations.
} // namespace