Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm

Issue 12605010: Add new option to open history page to show more other devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_GT Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_nsobject.h" 5 #include "base/memory/scoped_nsobject.h"
6 #include "base/sys_string_conversions.h" 6 #include "base/sys_string_conversions.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/search/search.h" 9 #include "chrome/browser/search/search.h"
10 #include "chrome/browser/sync/glue/session_model_associator.h" 10 #include "chrome/browser/sync/glue/session_model_associator.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU, 102 IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU,
103 &recent_tabs_sub_menu_model); 103 &recent_tabs_sub_menu_model);
104 104
105 [controller() setModel:fake_model_.get()]; 105 [controller() setModel:fake_model_.get()];
106 NSMenu* menu = [controller() menu]; 106 NSMenu* menu = [controller() menu];
107 [controller() updateRecentTabsSubmenu]; 107 [controller() updateRecentTabsSubmenu];
108 108
109 NSString* title = l10n_util::GetNSStringWithFixup(IDS_RECENT_TABS_MENU); 109 NSString* title = l10n_util::GetNSStringWithFixup(IDS_RECENT_TABS_MENU);
110 NSMenu* recent_tabs_menu = [[menu itemWithTitle:title] submenu]; 110 NSMenu* recent_tabs_menu = [[menu itemWithTitle:title] submenu];
111 EXPECT_TRUE(recent_tabs_menu); 111 EXPECT_TRUE(recent_tabs_menu);
112 EXPECT_EQ(4, [recent_tabs_menu numberOfItems]); 112 EXPECT_EQ(6, [recent_tabs_menu numberOfItems]);
113 113
114 // Send a icon changed event and verify that the icon is updated. 114 // Send a icon changed event and verify that the icon is updated.
115 gfx::Image icon(ResourceBundle::GetSharedInstance().GetNativeImageNamed( 115 gfx::Image icon(ResourceBundle::GetSharedInstance().GetNativeImageNamed(
116 IDR_BOOKMARKS_FAVICON)); 116 IDR_BOOKMARKS_FAVICON));
117 recent_tabs_sub_menu_model.SetIcon(3, icon); 117 recent_tabs_sub_menu_model.SetIcon(3, icon);
118 EXPECT_NSNE(icon.ToNSImage(), [[recent_tabs_menu itemAtIndex:3] image]); 118 EXPECT_NSNE(icon.ToNSImage(), [[recent_tabs_menu itemAtIndex:3] image]);
119 recent_tabs_sub_menu_model.GetMenuModelDelegate()->OnIconChanged(3); 119 recent_tabs_sub_menu_model.GetMenuModelDelegate()->OnIconChanged(3);
120 EXPECT_TRUE([[recent_tabs_menu itemAtIndex:3] image]); 120 EXPECT_TRUE([[recent_tabs_menu itemAtIndex:3] image]);
121 EXPECT_NSEQ(icon.ToNSImage(), [[recent_tabs_menu itemAtIndex:3] image]); 121 EXPECT_NSEQ(icon.ToNSImage(), [[recent_tabs_menu itemAtIndex:3] image]);
122 122
(...skipping 25 matching lines...) Expand all
148 IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU, 148 IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU,
149 &recent_tabs_sub_menu_model); 149 &recent_tabs_sub_menu_model);
150 150
151 [controller() setModel:fake_model_.get()]; 151 [controller() setModel:fake_model_.get()];
152 NSMenu* menu = [controller() menu]; 152 NSMenu* menu = [controller() menu];
153 [controller() updateRecentTabsSubmenu]; 153 [controller() updateRecentTabsSubmenu];
154 154
155 NSString* title = l10n_util::GetNSStringWithFixup(IDS_RECENT_TABS_MENU); 155 NSString* title = l10n_util::GetNSStringWithFixup(IDS_RECENT_TABS_MENU);
156 NSMenu* recent_tabs_menu = [[menu itemWithTitle:title] submenu]; 156 NSMenu* recent_tabs_menu = [[menu itemWithTitle:title] submenu];
157 EXPECT_TRUE(recent_tabs_menu); 157 EXPECT_TRUE(recent_tabs_menu);
158 EXPECT_EQ(5, [recent_tabs_menu numberOfItems]); 158 EXPECT_EQ(7, [recent_tabs_menu numberOfItems]);
159 159
160 // Index 0: restore tabs menu item. 160 // Index 0: restore tabs menu item.
161 NSString* restore_tab_label = l10n_util::FixUpWindowsStyleLabel( 161 NSString* restore_tab_label = l10n_util::FixUpWindowsStyleLabel(
162 recent_tabs_sub_menu_model.GetLabelAt(0)); 162 recent_tabs_sub_menu_model.GetLabelAt(0));
163 EXPECT_NSEQ(restore_tab_label, [[recent_tabs_menu itemAtIndex:0] title]); 163 EXPECT_NSEQ(restore_tab_label, [[recent_tabs_menu itemAtIndex:0] title]);
164 164
165 // Item 1: separator. 165 // Item 1: separator.
166 EXPECT_TRUE([[recent_tabs_menu itemAtIndex:1] isSeparatorItem]); 166 EXPECT_TRUE([[recent_tabs_menu itemAtIndex:1] isSeparatorItem]);
167 167
168 // Item 2: window title. 168 // Item 2: window title.
(...skipping 21 matching lines...) Expand all
190 190
191 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model 191 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model
192 // it's observing. 192 // it's observing.
193 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { 193 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) {
194 chrome::search::EnableInstantExtendedAPIForTesting(); 194 chrome::search::EnableInstantExtendedAPIForTesting();
195 [controller_ menuNeedsUpdate:[controller_ menu]]; 195 [controller_ menuNeedsUpdate:[controller_ menu]];
196 // If the delete order is wrong then the test will crash on exit. 196 // If the delete order is wrong then the test will crash on exit.
197 } 197 }
198 198
199 } // namespace 199 } // namespace
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698