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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.mm

Issue 8141003: [Mac] Restore the old bookmark menus now that the experiment is over. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h"
6 6
7 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
8 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
9
10 NSUInteger NumberOfMenuItems(BookmarkBarFolderController* folder) {
11 if (![folder menuBridge])
12 return 0;
13 return [[[[folder menuBridge]->controller() menu] itemArray] count];
14 }
15
16 void CloseFolderAfterDelay(BookmarkBarFolderController* folder,
17 NSTimeInterval delay) {
18 NSArray* modes = [NSArray arrayWithObjects:NSDefaultRunLoopMode,
19 NSEventTrackingRunLoopMode, nil];
20 [folder performSelector:@selector(closeMenu)
21 withObject:nil
22 afterDelay:delay
23 inModes:modes];
24 }
25
26 @interface NSArray (BookmarkBarUnitTestHelper) 7 @interface NSArray (BookmarkBarUnitTestHelper)
27 8
28 // A helper function for scanning an array of buttons looking for the 9 // A helper function for scanning an array of buttons looking for the
29 // button with the given |title|. 10 // button with the given |title|.
30 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title; 11 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title;
31 12
32 @end 13 @end
33 14
34 15
35 @implementation NSArray (BookmarkBarUnitTestHelper) 16 @implementation NSArray (BookmarkBarUnitTestHelper)
36 17
37 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title { 18 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title {
38 for (BookmarkButton* button in self) { 19 for (BookmarkButton* button in self) {
39 if ([[button title] isEqualToString:title]) 20 if ([[button title] isEqualToString:title])
40 return button; 21 return button;
41 } 22 }
42 return nil; 23 return nil;
43 } 24 }
44 25
45 @end 26 @end
46 27
47 @implementation BookmarkBarController (BookmarkBarUnitTestHelper) 28 @implementation BookmarkBarController (BookmarkBarUnitTestHelper)
48 29
49 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title { 30 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title {
50 return [[self buttons] buttonWithTitleEqualTo:title]; 31 return [[self buttons] buttonWithTitleEqualTo:title];
51 } 32 }
52 33
53 @end 34 @end
54 35
36 @implementation BookmarkBarFolderController(BookmarkBarUnitTestHelper)
37
38 - (BookmarkButton*)buttonWithTitleEqualTo:(NSString*)title {
39 return [[self buttons] buttonWithTitleEqualTo:title];
40 }
41
42 @end
43
55 @implementation BookmarkButton(BookmarkBarUnitTestHelper) 44 @implementation BookmarkButton(BookmarkBarUnitTestHelper)
56 45
57 - (NSPoint)center { 46 - (NSPoint)center {
58 NSRect frame = [self frame]; 47 NSRect frame = [self frame];
59 NSPoint center = NSMakePoint(NSMidX(frame), NSMidY(frame)); 48 NSPoint center = NSMakePoint(NSMidX(frame), NSMidY(frame));
60 center = [[self superview] convertPoint:center toView:nil]; 49 center = [[self superview] convertPoint:center toView:nil];
61 return center; 50 return center;
62 } 51 }
63 52
64 - (NSPoint)top { 53 - (NSPoint)top {
(...skipping 18 matching lines...) Expand all
83 } 72 }
84 73
85 - (NSPoint)right { 74 - (NSPoint)right {
86 NSRect frame = [self frame]; 75 NSRect frame = [self frame];
87 NSPoint right = NSMakePoint(NSMaxX(frame), NSMidY(frame)); 76 NSPoint right = NSMakePoint(NSMaxX(frame), NSMidY(frame));
88 right = [[self superview] convertPoint:right toView:nil]; 77 right = [[self superview] convertPoint:right toView:nil];
89 return right; 78 return right;
90 } 79 }
91 80
92 @end 81 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_unittest_helper.h ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698