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

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

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #import "chrome/browser/cocoa/bookmark_bar_constants.h" 10 #import "chrome/browser/cocoa/bookmark_bar_constants.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 toggles_++; 77 toggles_++;
78 } 78 }
79 79
80 @end 80 @end
81 81
82 namespace { 82 namespace {
83 83
84 static const int kContentAreaHeight = 500; 84 static const int kContentAreaHeight = 500;
85 static const int kInfoBarViewHeight = 30; 85 static const int kInfoBarViewHeight = 30;
86 86
87 class BookmarkBarControllerTest : public PlatformTest { 87 class BookmarkBarControllerTest : public CocoaTest {
88 public: 88 public:
89 BookmarkBarControllerTest() { 89 BookmarkBarControllerTest() {
90 resizeDelegate_.reset([[ViewResizerPong alloc] init]); 90 resizeDelegate_.reset([[ViewResizerPong alloc] init]);
91 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); 91 NSRect parent_frame = NSMakeRect(0, 0, 800, 50);
92 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); 92 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]);
93 [parent_view_ setHidden:YES]; 93 [parent_view_ setHidden:YES];
94 bar_.reset( 94 bar_.reset(
95 [[BookmarkBarControllerNoOpen alloc] 95 [[BookmarkBarControllerNoOpen alloc]
96 initWithBrowser:helper_.browser() 96 initWithBrowser:helper_.browser()
97 initialWidth:NSWidth(parent_frame) 97 initialWidth:NSWidth(parent_frame)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 [menu_ setRepresentedObject:[NSValue valueWithPointer:node_.get()]]; 139 [menu_ setRepresentedObject:[NSValue valueWithPointer:node_.get()]];
140 return menu_item_; 140 return menu_item_;
141 } 141 }
142 142
143 // Does NOT take ownership of node. 143 // Does NOT take ownership of node.
144 NSMenuItem* ItemForBookmarkBarMenu(const BookmarkNode* node) { 144 NSMenuItem* ItemForBookmarkBarMenu(const BookmarkNode* node) {
145 [menu_ setRepresentedObject:[NSValue valueWithPointer:node]]; 145 [menu_ setRepresentedObject:[NSValue valueWithPointer:node]];
146 return menu_item_; 146 return menu_item_;
147 } 147 }
148 148
149 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... 149 BrowserTestHelper helper_;
150 scoped_nsobject<NSView> parent_view_; 150 scoped_nsobject<NSView> parent_view_;
151 BrowserTestHelper helper_;
152 scoped_nsobject<ViewResizerPong> resizeDelegate_; 151 scoped_nsobject<ViewResizerPong> resizeDelegate_;
153 scoped_nsobject<BookmarkBarControllerNoOpen> bar_; 152 scoped_nsobject<BookmarkBarControllerNoOpen> bar_;
154 scoped_nsobject<BookmarkMenu> menu_; 153 scoped_nsobject<BookmarkMenu> menu_;
155 scoped_nsobject<NSMenuItem> menu_item_; 154 scoped_nsobject<NSMenuItem> menu_item_;
156 scoped_nsobject<NSButtonCell> cell_; 155 scoped_nsobject<NSButtonCell> cell_;
157 scoped_ptr<BookmarkNode> node_; 156 scoped_ptr<BookmarkNode> node_;
158 }; 157 };
159 158
160 TEST_F(BookmarkBarControllerTest, ShowWhenShowBookmarkBarTrue) { 159 TEST_F(BookmarkBarControllerTest, ShowWhenShowBookmarkBarTrue) {
161 [bar_ updateAndShowNormalBar:YES 160 [bar_ updateAndShowNormalBar:YES
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // Finally, a drop of the 1st between the next 2 782 // Finally, a drop of the 1st between the next 2
784 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]); 783 CGFloat x = NSMinX([[[bar_ buttons] objectAtIndex:2] frame]);
785 x += [[bar_ view] frame].origin.x; 784 x += [[bar_ view] frame].origin.x;
786 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] to:NSMakePoint(x, 0)]; 785 [bar_ dragButton:[[bar_ buttons] objectAtIndex:0] to:NSMakePoint(x, 0)];
787 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"b"]); 786 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:0] title] isEqual:@"b"]);
788 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"c"]); 787 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:1] title] isEqual:@"c"]);
789 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]); 788 EXPECT_TRUE([[[[bar_ buttons] objectAtIndex:2] title] isEqual:@"a"]);
790 } 789 }
791 790
792 } // namespace 791 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698