diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 23:18:20 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 23:18:20 +0000 |
commit | 21bf93a0311fda75e2c42d91953399405d0aa8c9 (patch) | |
tree | 9a2c2873ad0cd5859f21ff60d82068c5c2e396e4 /chrome/browser/cocoa/bookmark_manager_controller_unittest.mm | |
parent | ec5ad198a786ee42607568d14881ca54451ce95b (diff) | |
download | chromium_src-21bf93a0311fda75e2c42d91953399405d0aa8c9.zip chromium_src-21bf93a0311fda75e2c42d91953399405d0aa8c9.tar.gz chromium_src-21bf93a0311fda75e2c42d91953399405d0aa8c9.tar.bz2 |
Mac bookmark mgr: UI overhaul, and adding Recents and Search features.
The list views now match the Windows version: left one is a tree that only shows folders, right one is a flat list.
In BookmarkManager.xib: left pane changed to BookmarkTreeController, 'folder' column added to right outline view, toolbar added.
BUG=31969,32080
TEST=new unit tests on BookmarkManagerController, BookmarkItem, BookmarkTreeController.
Review URL: http://codereview.chromium.org/536063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36432 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_manager_controller_unittest.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_manager_controller_unittest.mm | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/bookmark_manager_controller_unittest.mm b/chrome/browser/cocoa/bookmark_manager_controller_unittest.mm index c319b46..50c2357 100644 --- a/chrome/browser/cocoa/bookmark_manager_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_manager_controller_unittest.mm @@ -5,6 +5,7 @@ #include "base/scoped_nsobject.h" #import "chrome/browser/cocoa/bookmark_item.h" #import "chrome/browser/cocoa/bookmark_manager_controller.h" +#import "chrome/browser/cocoa/bookmark_tree_controller.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" @@ -26,6 +27,21 @@ class BookmarkManagerControllerTest : public CocoaTest { CocoaTest::TearDown(); } + BookmarkItem* AddToBar(NSString*title, NSString* urlStr) { + BookmarkItem* bar = [controller_ bookmarkBarItem]; + return [bar addBookmarkWithTitle:title + URL:urlStr + atIndex:[bar numberOfChildren]]; + } + + NSSet* AddFixtureItems() { + return [NSSet setWithObjects: + AddToBar(@"Google", @"http://google.com"), + AddToBar(@"GMail", @"http://gmail.com"), + AddToBar(@"Google Sites", @"http://sites.google.com"), + nil]; + } + BrowserTestHelper browser_test_helper_; BookmarkManagerController* controller_; }; @@ -36,7 +52,7 @@ TEST_F(BookmarkManagerControllerTest, IsThisThingTurnedOn) { EXPECT_TRUE([w isVisible]); ASSERT_TRUE([controller_ groupsController]); - ASSERT_TRUE([controller_ treeController]); + ASSERT_TRUE([controller_ listController]); } TEST_F(BookmarkManagerControllerTest, Model) { @@ -74,4 +90,34 @@ TEST_F(BookmarkManagerControllerTest, Model) { EXPECT_NE(otherItem, otherItem2); } +TEST_F(BookmarkManagerControllerTest, Recents) { + NSSet* fixtures = AddFixtureItems(); + // Show the Recent Items group, so its contents will be updated. + FakeBookmarkItem* recents = [controller_ recentGroup]; + [controller_ showGroup:recents]; + NSSet* shown = [NSSet setWithArray:[recents children]]; + EXPECT_TRUE([fixtures isEqual:shown]); +} + +TEST_F(BookmarkManagerControllerTest, Search) { + AddFixtureItems(); + // Search for 'gmail': + [controller_ setSearchString:@"gmail"]; + FakeBookmarkItem* search = [controller_ searchGroup]; + EXPECT_EQ(search, [[controller_ groupsController] selectedItem]); + NSArray* shown = [search children]; + EXPECT_EQ(1U, [shown count]); + EXPECT_TRUE([@"GMail" isEqualToString:[[shown lastObject] title]]); + + // Search for 'google': + [controller_ setSearchString:@"google"]; + shown = [search children]; + EXPECT_EQ(2U, [shown count]); + + // Search for 'fnord': + [controller_ setSearchString:@"fnord"]; + shown = [search children]; + EXPECT_EQ(0U, [shown count]); +} + } // namespace |