diff options
Diffstat (limited to 'chrome/browser/ui')
10 files changed, 230 insertions, 54 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm index fb6f6eb..b8b6145 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.mm @@ -5,7 +5,6 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h" #include "base/sys_string_conversions.h" -#include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" // IDC_BOOKMARK_MENU #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -14,8 +13,8 @@ #include "chrome/browser/ui/browser_finder.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" #include "chrome/browser/ui/cocoa/event_utils.h" +#include "chrome/browser/ui/cocoa/menu_controller.h" #include "content/public/browser/user_metrics.h" -#include "ui/base/text/text_elider.h" using content::OpenURLParams; using content::Referrer; @@ -32,13 +31,8 @@ const NSUInteger kMaximumMenuPixelsWide = 300; @implementation BookmarkMenuCocoaController + (NSString*)menuTitleForNode:(const BookmarkNode*)node { - NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" - gfx::Font font(base::SysNSStringToUTF8([nsfont fontName]), - static_cast<int>([nsfont pointSize])); - string16 title = ui::ElideText(node->GetTitle(), - font, - kMaximumMenuPixelsWide, - ui::ELIDE_AT_END); + string16 title = [MenuController elideMenuTitle:node->GetTitle() + toWidth:kMaximumMenuPixelsWide]; return base::SysUTF16ToNSString(title); } diff --git a/chrome/browser/ui/cocoa/menu_controller.h b/chrome/browser/ui/cocoa/menu_controller.h index 1605523..f22b200 100644 --- a/chrome/browser/ui/cocoa/menu_controller.h +++ b/chrome/browser/ui/cocoa/menu_controller.h @@ -8,6 +8,7 @@ #import <Cocoa/Cocoa.h> #include "base/memory/scoped_nsobject.h" +#include "base/string16.h" namespace ui { class MenuModel; @@ -32,6 +33,9 @@ class MenuModel; // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. @property(nonatomic) BOOL useWithPopUpButtonCell; ++ (string16)elideMenuTitle:(const string16&)title + toWidth:(int)width; + // NIB-based initializer. This does not create a menu. Clients can set the // properties of the object and the menu will be created upon the first call to // |-menu|. Note that the menu will be immutable after creation. @@ -71,6 +75,10 @@ class MenuModel; fromModel:(ui::MenuModel*)model modelIndex:(int)modelIndex; - (NSMenu*)menuFromModel:(ui::MenuModel*)model; +// Returns the maximum width for the menu item. Returns -1 to indicate +// that there's no maximum width. +- (int)maxWidthForMenuModel:(ui::MenuModel*)model + modelIndex:(int)modelIndex; @end #endif // CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ diff --git a/chrome/browser/ui/cocoa/menu_controller.mm b/chrome/browser/ui/cocoa/menu_controller.mm index 9563ee2..99c4c14 100644 --- a/chrome/browser/ui/cocoa/menu_controller.mm +++ b/chrome/browser/ui/cocoa/menu_controller.mm @@ -11,6 +11,7 @@ #include "ui/base/accelerators/platform_accelerator_cocoa.h" #include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/models/simple_menu_model.h" +#include "ui/base/text/text_elider.h" #include "ui/gfx/image/image.h" @interface MenuController (Private) @@ -23,6 +24,14 @@ @synthesize model = model_; @synthesize useWithPopUpButtonCell = useWithPopUpButtonCell_; ++ (string16)elideMenuTitle:(const string16&)title + toWidth:(int)width { + NSFont* nsfont = [NSFont menuBarFontOfSize:0]; // 0 means "default" + gfx::Font font(base::SysNSStringToUTF8([nsfont fontName]), + static_cast<int>([nsfont pointSize])); + return ui::ElideText(title, font, width, ui::ELIDE_AT_END); +} + - (id)init { self = [super init]; return self; @@ -83,6 +92,11 @@ return menu; } +- (int)maxWidthForMenuModel:(ui::MenuModel*)model + modelIndex:(int)modelIndex { + return -1; +} + // Adds a separator item at the given index. As the separator doesn't need // anything from the model, this method doesn't need the model index as the // other method below does. @@ -98,8 +112,12 @@ atIndex:(NSInteger)index fromModel:(ui::MenuModel*)model modelIndex:(int)modelIndex { - NSString* label = - l10n_util::FixUpWindowsStyleLabel(model->GetLabelAt(modelIndex)); + string16 label16 = model->GetLabelAt(modelIndex); + int maxWidth = [self maxWidthForMenuModel:model modelIndex:modelIndex]; + if (maxWidth != -1) + label16 = [MenuController elideMenuTitle:label16 toWidth:maxWidth]; + + NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); scoped_nsobject<NSMenuItem> item( [[NSMenuItem alloc] initWithTitle:label action:@selector(itemSelected:) diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm index 9e823f4..59d8d16 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm @@ -43,6 +43,8 @@ using content::UserMetricsAction; - (NSButton*)zoomDisplay; - (void)removeAllItems:(NSMenu*)menu; - (NSMenu*)recentTabsSubmenu; +- (int)maxWidthForMenuModel:(ui::MenuModel*)model + modelIndex:(int)modelIndex; @end namespace WrenchMenuControllerInternal { @@ -321,6 +323,22 @@ class ZoomLevelObserver : public content::NotificationObserver { return [[[self menu] itemWithTitle:title] submenu]; } +// This overrdies the parent class to return a custom width for recent tabs +// menu. +- (int)maxWidthForMenuModel:(ui::MenuModel*)model + modelIndex:(int)modelIndex { + int index = 0; + ui::MenuModel* recentTabsMenuModel = [self wrenchMenuModel]; + if (ui::MenuModel::GetModelAndIndexForCommandId( + IDC_RESTORE_TAB, &recentTabsMenuModel, &index)) { + if (recentTabsMenuModel == model) { + return static_cast<RecentTabsSubMenuModel*>( + recentTabsMenuModel)->GetMaxWidthForItemAtIndex(modelIndex); + } + } + return -1; +} + @end // @implementation WrenchMenuController //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm index 327684a..394e157 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/memory/scoped_nsobject.h" +#include "base/sys_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/sync/glue/session_model_associator.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -75,7 +76,7 @@ TEST_F(WrenchMenuControllerTest, DispatchSimple) { chrome::testing::NSRunLoopRunAllPending(); } -TEST_F(WrenchMenuControllerTest, RecentTabs) { +TEST_F(WrenchMenuControllerTest, RecentTabsFavIcon) { ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile()); browser_sync::SessionModelAssociator associator_(sync_service, true); @@ -115,4 +116,68 @@ TEST_F(WrenchMenuControllerTest, RecentTabs) { fake_model_.reset(); } +TEST_F(WrenchMenuControllerTest, RecentTabsElideTitle) { + ProfileSyncService* sync_service = + ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile()); + browser_sync::SessionModelAssociator associator_(sync_service, true); + associator_.SetCurrentMachineTagForTesting("WrenchMenuControllerTest"); + + // Add 1 session with 1 window and 2 tabs. + RecentTabsBuilderTestHelper recent_tabs_builder; + recent_tabs_builder.AddSession(); + recent_tabs_builder.AddWindow(0); + string16 tab1_short_title = ASCIIToUTF16("Short"); + recent_tabs_builder.AddTabWithInfo(0, 0, base::Time::Now(), tab1_short_title); + string16 tab2_long_title = ASCIIToUTF16("Very very very very very very " + "very very very very very very long"); + recent_tabs_builder.AddTabWithInfo(0, 0, + base::Time::Now() - base::TimeDelta::FromMinutes(10), tab2_long_title); + recent_tabs_builder.RegisterRecentTabs(&associator_); + + RecentTabsSubMenuModel recent_tabs_sub_menu_model( + NULL, browser(), &associator_); + fake_model_->AddSubMenuWithStringId( + IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU, + &recent_tabs_sub_menu_model); + + [controller() setModel:fake_model_.get()]; + NSMenu* menu = [controller() menu]; + [controller() updateRecentTabsSubmenu]; + + NSString* title = l10n_util::GetNSStringWithFixup(IDS_RECENT_TABS_MENU); + NSMenu* recent_tabs_menu = [[menu itemWithTitle:title] submenu]; + EXPECT_TRUE(recent_tabs_menu); + EXPECT_EQ(5, [recent_tabs_menu numberOfItems]); + + // Index 0: restore tabs menu item. + NSString* restore_tab_label = l10n_util::FixUpWindowsStyleLabel( + recent_tabs_sub_menu_model.GetLabelAt(0)); + EXPECT_NSEQ(restore_tab_label, [[recent_tabs_menu itemAtIndex:0] title]); + + // Item 1: separator. + EXPECT_TRUE([[recent_tabs_menu itemAtIndex:1] isSeparatorItem]); + + // Item 2: window title. + EXPECT_NSEQ( + base::SysUTF16ToNSString(recent_tabs_sub_menu_model.GetLabelAt(2)), + [[recent_tabs_menu itemAtIndex:2] title]); + + // Item 3: short tab title. + EXPECT_NSEQ(base::SysUTF16ToNSString(tab1_short_title), + [[recent_tabs_menu itemAtIndex:3] title]); + + // Item 4: long tab title. + NSString* tab2_actual_title = [[recent_tabs_menu itemAtIndex:4] title]; + NSUInteger title_length = [tab2_actual_title length]; + EXPECT_GT(tab2_long_title.size(), title_length); + NSString* actual_substring = + [tab2_actual_title substringToIndex:title_length - 1]; + NSString* expected_substring = [base::SysUTF16ToNSString(tab2_long_title) + substringToIndex:title_length - 1]; + EXPECT_NSEQ(expected_substring, actual_substring); + + controller_.reset(); + fake_model_.reset(); +} + } // namespace diff --git a/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.cc b/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.cc index dba7d8f..1a267db 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.cc @@ -56,6 +56,25 @@ std::string ToTabUrl(SessionID::id_type session_id, } // namespace +struct RecentTabsBuilderTestHelper::TabInfo { + TabInfo() : id(0) {} + SessionID::id_type id; + base::Time timestamp; + string16 title; +}; +struct RecentTabsBuilderTestHelper::WindowInfo { + WindowInfo() : id(0) {} + ~WindowInfo() {} + SessionID::id_type id; + std::vector<TabInfo> tabs; +}; +struct RecentTabsBuilderTestHelper::SessionInfo { + SessionInfo() : id(0) {} + ~SessionInfo() {} + SessionID::id_type id; + std::vector<WindowInfo> windows; +}; + RecentTabsBuilderTestHelper::RecentTabsBuilderTestHelper() { start_time_ = base::Time::Now(); } @@ -110,15 +129,17 @@ SessionID::id_type RecentTabsBuilderTestHelper::GetWindowID(int session_index, void RecentTabsBuilderTestHelper::AddTab(int session_index, int window_index) { base::Time timestamp = start_time_ + base::TimeDelta::FromMinutes(base::RandUint64()); - AddTabWithTimestamp(session_index, window_index, timestamp); + AddTabWithInfo(session_index, window_index, timestamp, string16()); } -void RecentTabsBuilderTestHelper::AddTabWithTimestamp(int session_index, - int window_index, - base::Time timestamp) { +void RecentTabsBuilderTestHelper::AddTabWithInfo(int session_index, + int window_index, + base::Time timestamp, + const string16& title) { TabInfo tab_info; tab_info.id = CreateUniqueID(); tab_info.timestamp = timestamp; + tab_info.title = title; sessions_[session_index].windows[window_index].tabs.push_back(tab_info); } @@ -140,6 +161,20 @@ base::Time RecentTabsBuilderTestHelper::GetTabTimestamp(int session_index, .tabs[tab_index].timestamp; } +string16 RecentTabsBuilderTestHelper::GetTabTitle(int session_index, + int window_index, + int tab_index) { + string16 title = + sessions_[session_index].windows[window_index].tabs[tab_index].title; + if (title.empty()) { + title = UTF8ToUTF16(ToTabTitle( + GetSessionID(session_index), + GetWindowID(session_index, window_index), + GetTabID(session_index, window_index, tab_index))); + } + return title; +} + void RecentTabsBuilderTestHelper::RegisterRecentTabs( browser_sync::SessionModelAssociator* associator) { for (int s = 0; s < GetSessionCount(); ++s) { @@ -178,8 +213,7 @@ RecentTabsBuilderTestHelper::GetTabTitlesSortedByRecency() { for (int w = 0; w < GetWindowCount(s); ++w) { for (int t = 0; t < GetTabCount(s, w); ++t) { TitleTimestampPair pair; - pair.title = UTF8ToUTF16(ToTabTitle( - GetSessionID(s), GetWindowID(s, w), GetTabID(s, w, t))); + pair.title = GetTabTitle(s, w, t); pair.timestamp = GetTabTimestamp(s, w, t); tabs.push_back(pair); } @@ -237,14 +271,7 @@ void RecentTabsBuilderTestHelper::BuildTabSpecifics( sync_pb::TabNavigation* navigation = tab->add_navigation(); navigation->set_virtual_url(ToTabUrl(session_id, window_id, tab_id)); navigation->set_referrer("referrer"); - navigation->set_title(ToTabTitle(session_id, window_id, tab_id)); + navigation->set_title(UTF16ToUTF8(GetTabTitle( + session_index, window_index, tab_index))); navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED); } - -RecentTabsBuilderTestHelper::WindowInfo::WindowInfo() {} - -RecentTabsBuilderTestHelper::WindowInfo::~WindowInfo() {} - -RecentTabsBuilderTestHelper::SessionInfo::SessionInfo() {} - -RecentTabsBuilderTestHelper::SessionInfo::~SessionInfo() {} diff --git a/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h b/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h index eaa67dc..6ca1fc2 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h +++ b/chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h @@ -34,9 +34,10 @@ class RecentTabsBuilderTestHelper { SessionID::id_type GetWindowID(int session_index, int window_index); void AddTab(int session_index, int window_index); - void AddTabWithTimestamp(int session_index, - int window_index, - base::Time timestamp); + void AddTabWithInfo(int session_index, + int window_index, + base::Time timestamp, + const string16& title); int GetTabCount(int session_index, int window_index); SessionID::id_type GetTabID(int session_index, int window_index, @@ -44,6 +45,9 @@ class RecentTabsBuilderTestHelper { base::Time GetTabTimestamp(int session_index, int window_index, int tab_index); + string16 GetTabTitle(int session_index, + int window_index, + int tab_index); void RegisterRecentTabs(browser_sync::SessionModelAssociator* associator); @@ -60,22 +64,9 @@ class RecentTabsBuilderTestHelper { int tab_index, sync_pb::SessionSpecifics* tab_base); - struct TabInfo { - SessionID::id_type id; - base::Time timestamp; - }; - struct WindowInfo { - WindowInfo(); - ~WindowInfo(); - SessionID::id_type id; - std::vector<TabInfo> tabs; - }; - struct SessionInfo { - SessionInfo(); - ~SessionInfo(); - SessionID::id_type id; - std::vector<WindowInfo> windows; - }; + struct TabInfo; + struct WindowInfo; + struct SessionInfo; std::vector<SessionInfo> sessions_; base::Time start_time_; diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc index bf982d0..17f9672 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc @@ -147,8 +147,10 @@ bool RecentTabsSubMenuModel::IsCommandIdChecked(int command_id) const { bool RecentTabsSubMenuModel::IsCommandIdEnabled(int command_id) const { if (command_id == IDC_RESTORE_TAB) return chrome::IsCommandEnabled(browser_, command_id); - if (command_id == kDisabledCommandId) + if (command_id == kDisabledCommandId || + command_id == IDC_RECENT_TABS_NO_DEVICE_TABS) { return false; + } int model_index = CommandIdToModelIndex(command_id); return model_index >= 0 && model_index < static_cast<int>(model_.size()); } @@ -193,7 +195,9 @@ void RecentTabsSubMenuModel::ExecuteCommand(int command_id, int event_flags) { return; } - DCHECK(command_id != kDisabledCommandId); + DCHECK_NE(kDisabledCommandId, command_id); + DCHECK_NE(IDC_RECENT_TABS_NO_DEVICE_TABS, command_id); + int model_idx = CommandIdToModelIndex(command_id); DCHECK(model_idx >= 0 && model_idx < static_cast<int>(model_.size())); const NavigationItem& item = model_[model_idx]; @@ -233,6 +237,15 @@ void RecentTabsSubMenuModel::ExecuteCommand(int command_id, int event_flags) { } } +int RecentTabsSubMenuModel::GetMaxWidthForItemAtIndex(int item_index) const { + int command_id = GetCommandIdAt(item_index); + if (command_id == IDC_RECENT_TABS_NO_DEVICE_TABS || + command_id == IDC_RESTORE_TAB) { + return -1; + } + return 320; +} + void RecentTabsSubMenuModel::Build() { // The menu contains: // - Reopen closed tab, then separator @@ -243,8 +256,10 @@ void RecentTabsSubMenuModel::Build() { // other devices. BuildLastClosed(); BuildDevices(); - if (model_.empty()) - AddItemWithStringId(kDisabledCommandId, IDS_RECENT_TABS_NO_DEVICE_TABS); + if (model_.empty()) { + AddItemWithStringId(IDC_RECENT_TABS_NO_DEVICE_TABS, + IDS_RECENT_TABS_NO_DEVICE_TABS); + } } void RecentTabsSubMenuModel::BuildLastClosed() { diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h index e15d433..95a3d01 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h @@ -52,6 +52,8 @@ class RecentTabsSubMenuModel : public ui::SimpleMenuModel, virtual void ExecuteCommand(int command_id) OVERRIDE; virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; + int GetMaxWidthForItemAtIndex(int item_index) const; + private: struct NavigationItem; typedef std::vector<NavigationItem> NavigationItems; diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc index 242d037..a3f36d2 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc @@ -118,7 +118,7 @@ TEST_F(RecentTabsSubMenuModelTest, OtherDevices) { recent_tabs_builder.AddWindow(0); for (int i = 0; i < 3; ++i) { timestamp -= time_delta; - recent_tabs_builder.AddTabWithTimestamp(0, 0, timestamp); + recent_tabs_builder.AddTabWithInfo(0, 0, timestamp, string16()); } // Create 2nd session : 2 windows, 1 tab in 1st window, 2 tabs in 2nd window @@ -126,11 +126,11 @@ TEST_F(RecentTabsSubMenuModelTest, OtherDevices) { recent_tabs_builder.AddWindow(1); recent_tabs_builder.AddWindow(1); timestamp -= time_delta; - recent_tabs_builder.AddTabWithTimestamp(1, 0, timestamp); + recent_tabs_builder.AddTabWithInfo(1, 0, timestamp, string16()); timestamp -= time_delta; - recent_tabs_builder.AddTabWithTimestamp(1, 1, timestamp); + recent_tabs_builder.AddTabWithInfo(1, 1, timestamp, string16()); timestamp -= time_delta; - recent_tabs_builder.AddTabWithTimestamp(1, 1, timestamp); + recent_tabs_builder.AddTabWithInfo(1, 1, timestamp, string16()); recent_tabs_builder.RegisterRecentTabs(&associator_); @@ -237,3 +237,41 @@ TEST_F(RecentTabsSubMenuModelTest, MaxTabsPerSessionAndRecency) { for (int i = 0; i < 4; ++i) EXPECT_EQ(tab_titles[i], model.GetLabelAt(i + 3)); } + +TEST_F(RecentTabsSubMenuModelTest, MaxWidth) { + // Create 1 session with 1 window and 1 tab. + RecentTabsBuilderTestHelper recent_tabs_builder; + recent_tabs_builder.AddSession(); + recent_tabs_builder.AddWindow(0); + recent_tabs_builder.AddTab(0, 0); + recent_tabs_builder.RegisterRecentTabs(&associator_); + + // Menu index Menu items + // -------------------------------------- + // 0 Reopen closed tab + // 1 <separator> + // 2 <section header for 1st session> + // 3 <the only tab of the only window of session 1> + + TestRecentTabsSubMenuModel model(NULL, browser(), &associator_, true); + EXPECT_EQ(4, model.GetItemCount()); + EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); + EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); + EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(2)); + EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(3)); +} + +TEST_F(RecentTabsSubMenuModelTest, MaxWidthNoDevices) { + // Expected menu: + // Menu index Menu items + // -------------------------------------- + // 0 Reopen closed tab + // 1 <separator> + // 2 No tabs from other Devices + + TestRecentTabsSubMenuModel model(NULL, browser(), NULL, false); + EXPECT_EQ(3, model.GetItemCount()); + EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); + EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); + EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); +} |