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

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_controller_unittest.mm

Issue 164547: Mac: make save/open dialogs operate as tab-modal sheets.... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Painfully (but hopefully correctly) merged ToT. Created 11 years, 2 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 9 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
10 #import "chrome/browser/cocoa/bookmark_bar_view.h" 10 #import "chrome/browser/cocoa/bookmark_bar_view.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 resizeDelegate_.reset([[ViewResizerPong alloc] init]); 117 resizeDelegate_.reset([[ViewResizerPong alloc] init]);
118 compressDelegate_.reset([[CompressablePong alloc] init]); 118 compressDelegate_.reset([[CompressablePong alloc] init]);
119 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); 119 NSRect parent_frame = NSMakeRect(0, 0, 800, 50);
120 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); 120 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]);
121 [parent_view_ setHidden:YES]; 121 [parent_view_ setHidden:YES];
122 bar_.reset( 122 bar_.reset(
123 [[BookmarkBarController alloc] initWithBrowser:helper_.browser() 123 [[BookmarkBarController alloc] initWithBrowser:helper_.browser()
124 initialWidth:NSWidth(parent_frame) 124 initialWidth:NSWidth(parent_frame)
125 compressDelegate:compressDelegate_.get() 125 compressDelegate:compressDelegate_.get()
126 resizeDelegate:resizeDelegate_.get() 126 resizeDelegate:resizeDelegate_.get()
127 urlDelegate:nil]); 127 urlDelegate:nil
128 commands:NULL]);
128 129
129 InstallAndToggleBar(bar_.get()); 130 InstallAndToggleBar(bar_.get());
130 131
131 // Create a menu/item to act like a sender 132 // Create a menu/item to act like a sender
132 menu_.reset([[NSMenu alloc] initWithTitle:@"I_dont_care"]); 133 menu_.reset([[NSMenu alloc] initWithTitle:@"I_dont_care"]);
133 menu_item_.reset([[NSMenuItem alloc] 134 menu_item_.reset([[NSMenuItem alloc]
134 initWithTitle:@"still_dont_care" 135 initWithTitle:@"still_dont_care"
135 action:NULL 136 action:NULL
136 keyEquivalent:@""]); 137 keyEquivalent:@""]);
137 cell_.reset([[NSButtonCell alloc] init]); 138 cell_.reset([[NSButtonCell alloc] init]);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 TEST_F(BookmarkBarControllerTest, ShowOnNewTabPage) { 213 TEST_F(BookmarkBarControllerTest, ShowOnNewTabPage) {
213 helper_.profile()->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, false); 214 helper_.profile()->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, false);
214 215
215 scoped_nsobject<BookmarkBarControllerTogglePong> bar; 216 scoped_nsobject<BookmarkBarControllerTogglePong> bar;
216 bar.reset( 217 bar.reset(
217 [[AlwaysNewTabPageBookmarkBarController alloc] 218 [[AlwaysNewTabPageBookmarkBarController alloc]
218 initWithBrowser:helper_.browser() 219 initWithBrowser:helper_.browser()
219 initialWidth:100 // arbitrary 220 initialWidth:100 // arbitrary
220 compressDelegate:compressDelegate_.get() 221 compressDelegate:compressDelegate_.get()
221 resizeDelegate:resizeDelegate_.get() 222 resizeDelegate:resizeDelegate_.get()
222 urlDelegate:nil]); 223 urlDelegate:nil
224 commands:NULL]);
223 InstallAndToggleBar(bar.get()); 225 InstallAndToggleBar(bar.get());
224 226
225 [bar setBookmarkBarEnabled:NO]; 227 [bar setBookmarkBarEnabled:NO];
226 [bar updateVisibility]; 228 [bar updateVisibility];
227 229
228 EXPECT_TRUE([bar isVisible]); 230 EXPECT_TRUE([bar isVisible]);
229 EXPECT_FALSE([[bar view] isHidden]); 231 EXPECT_FALSE([[bar view] isHidden]);
230 EXPECT_GT([resizeDelegate_ height], 0); 232 EXPECT_GT([resizeDelegate_ height], 0);
231 EXPECT_GT([[bar view] frame].size.height, 0); 233 EXPECT_GT([[bar view] frame].size.height, 0);
232 } 234 }
233 235
234 // Make sure we're watching for frame change notifications. 236 // Make sure we're watching for frame change notifications.
235 TEST_F(BookmarkBarControllerTest, FrameChangeNotification) { 237 TEST_F(BookmarkBarControllerTest, FrameChangeNotification) {
236 scoped_nsobject<BookmarkBarControllerTogglePong> bar; 238 scoped_nsobject<BookmarkBarControllerTogglePong> bar;
237 bar.reset( 239 bar.reset(
238 [[BookmarkBarControllerTogglePong alloc] 240 [[BookmarkBarControllerTogglePong alloc]
239 initWithBrowser:helper_.browser() 241 initWithBrowser:helper_.browser()
240 initialWidth:100 // arbitrary 242 initialWidth:100 // arbitrary
241 compressDelegate:compressDelegate_.get() 243 compressDelegate:compressDelegate_.get()
242 resizeDelegate:resizeDelegate_.get() 244 resizeDelegate:resizeDelegate_.get()
243 urlDelegate:nil]); 245 urlDelegate:nil
246 commands:NULL]);
244 InstallAndToggleBar(bar.get()); 247 InstallAndToggleBar(bar.get());
245 248
246 // Send a frame did change notification for the pong's view. 249 // Send a frame did change notification for the pong's view.
247 [[NSNotificationCenter defaultCenter] 250 [[NSNotificationCenter defaultCenter]
248 postNotificationName:NSViewFrameDidChangeNotification 251 postNotificationName:NSViewFrameDidChangeNotification
249 object:[bar view]]; 252 object:[bar view]];
250 253
251 EXPECT_GT([bar toggles], 0); 254 EXPECT_GT([bar toggles], 0);
252 } 255 }
253 256
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 [bar_ loaded:model]; 650 [bar_ loaded:model];
648 EXPECT_TRUE([[[bar_ buttonView] noItemTextfield] isHidden]); 651 EXPECT_TRUE([[[bar_ buttonView] noItemTextfield] isHidden]);
649 } 652 }
650 653
651 // Cannot test these methods since they simply call a single static 654 // Cannot test these methods since they simply call a single static
652 // method, BookmarkEditor::Show(), which is impossible to mock. 655 // method, BookmarkEditor::Show(), which is impossible to mock.
653 // editBookmark:, addPage: 656 // editBookmark:, addPage:
654 657
655 658
656 } // namespace 659 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_controller.mm ('k') | chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698