summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 19:19:18 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 19:19:18 +0000
commitb5edb847c268532709058074328dd5565b7d9e7e (patch)
tree0aeb2fde7603e0aac321dc46a77e34c4417c41fc /chrome/browser/cocoa
parent3fd7933a5e06cc4c64bea3e61d1114cb895e3d0e (diff)
downloadchromium_src-b5edb847c268532709058074328dd5565b7d9e7e.zip
chromium_src-b5edb847c268532709058074328dd5565b7d9e7e.tar.gz
chromium_src-b5edb847c268532709058074328dd5565b7d9e7e.tar.bz2
Fix disabled unit test.
Certain calls now go direct to barController, not parentController. These changes bounce callbacks back to parentController in test code to be seen. BUG=none TEST=green tree Review URL: http://codereview.chromium.org/2904001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm33
1 files changed, 29 insertions, 4 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
index 703d2fb2..11598b7 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
+++ b/chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
@@ -94,6 +94,30 @@ namespace {
const int kLotsOfNodesCount = 150;
};
+
+// Redirect certain calls so they can be seen by tests.
+
+@interface BookmarkBarControllerChildFolderRedirect : BookmarkBarController {
+ BookmarkBarFolderController* childFolderDelegate_;
+}
+@property (nonatomic, assign) BookmarkBarFolderController* childFolderDelegate;
+@end
+
+@implementation BookmarkBarControllerChildFolderRedirect
+
+@synthesize childFolderDelegate = childFolderDelegate_;
+
+- (void)childFolderWillShow:(id<BookmarkButtonControllerProtocol>)child {
+ [childFolderDelegate_ childFolderWillShow:child];
+}
+
+- (void)childFolderWillClose:(id<BookmarkButtonControllerProtocol>)child {
+ [childFolderDelegate_ childFolderWillClose:child];
+}
+
+@end
+
+
class BookmarkBarFolderControllerTest : public CocoaTest {
public:
BrowserTestHelper helper_;
@@ -126,7 +150,7 @@ class BookmarkBarFolderControllerTest : public CocoaTest {
GURL("http://www.google.com/c"));
parentBarController_.reset(
- [[BookmarkBarController alloc]
+ [[BookmarkBarControllerChildFolderRedirect alloc]
initWithBrowser:helper_.browser()
initialWidth:300
delegate:nil
@@ -379,12 +403,11 @@ TEST_F(BookmarkBarFolderControllerTest, OpenFolder) {
EXPECT_FALSE([bbfc folderController]);
}
-// Test was bad; when code got fixed this test failed.
-// jrg working on this right now to make it test something correct.
-TEST_F(BookmarkBarFolderControllerTest, DISABLED_ChildFolderCallbacks) {
+TEST_F(BookmarkBarFolderControllerTest, ChildFolderCallbacks) {
scoped_nsobject<BookmarkBarFolderControllerPong> bbfc;
bbfc.reset(SimpleBookmarkBarFolderController());
EXPECT_TRUE(bbfc.get());
+ [parentBarController_ setChildFolderDelegate:bbfc.get()];
EXPECT_FALSE([bbfc childFolderWillShow]);
[bbfc openBookmarkFolderFromButton:[[bbfc buttons] objectAtIndex:0]];
@@ -393,6 +416,8 @@ TEST_F(BookmarkBarFolderControllerTest, DISABLED_ChildFolderCallbacks) {
EXPECT_FALSE([bbfc childFolderWillClose]);
[bbfc closeBookmarkFolder:nil];
EXPECT_TRUE([bbfc childFolderWillClose]);
+
+ [parentBarController_ setChildFolderDelegate:nil];
}
// Make sure bookmark folders have variable widths.