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

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

Issue 165499: Updates to clean up default theme and add hover states (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 // Toggle the pref and make sure the buttons changed state and the other 189 // Toggle the pref and make sure the buttons changed state and the other
190 // views moved (or in the case of the location bar, it changed width). 190 // views moved (or in the case of the location bar, it changed width).
191 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); 191 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons);
192 EXPECT_EQ(showButtons, [pageButton isHidden]); 192 EXPECT_EQ(showButtons, [pageButton isHidden]);
193 EXPECT_EQ(showButtons, [wrenchButton isHidden]); 193 EXPECT_EQ(showButtons, [wrenchButton isHidden]);
194 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); 194 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame]));
195 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); 195 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame]));
196 } 196 }
197 197
198 TEST_F(ToolbarControllerTest, BookmarkBarResizes) {
199 NSView* bookmarkBarView = [[bar_ bookmarkBarController] view];
200 ASSERT_EQ(0, NSHeight([bookmarkBarView frame]));
201 [resizeDelegate_ setHeight:-1];
202
203 // Resize the bookmarkbar to 30px. The toolbar should ask the delegate to
204 // resize to 64px.
205 [bar_ resizeView:bookmarkBarView newHeight:30];
206 EXPECT_EQ(64, [resizeDelegate_ height]);
207 EXPECT_EQ(30, NSHeight([bookmarkBarView frame]));
208
209 // Resize the bookmarkbar back to 0px. Toolbar should be at 39px.
210 [bar_ resizeView:bookmarkBarView newHeight:0];
211 EXPECT_EQ(39, [resizeDelegate_ height]);
212 EXPECT_EQ(0, NSHeight([bookmarkBarView frame]));
213
214 // Resize the bookmarkbar to 5px. Toolbar should stay at 39px.
215 [resizeDelegate_ setHeight:-1];
216 [bar_ resizeView:bookmarkBarView newHeight:5];
217 EXPECT_EQ(39, [resizeDelegate_ height]);
218 EXPECT_EQ(5, NSHeight([bookmarkBarView frame]));
219
220 // Resize the bookmarkbar to 6px. Toolbar should grow to 40px.
221 [bar_ resizeView:bookmarkBarView newHeight:6];
222 EXPECT_EQ(40, [resizeDelegate_ height]);
223 EXPECT_EQ(6, NSHeight([bookmarkBarView frame]));
224 }
225
226 // Make sure, by default, the bookmark bar is the full width of the 198 // Make sure, by default, the bookmark bar is the full width of the
227 // toolbar. 199 // toolbar.
228 TEST_F(ToolbarControllerTest, BookmarkBarIsFullWidth) { 200 TEST_F(ToolbarControllerTest, BookmarkBarIsFullWidth) {
229 // Set the pref to the bookmark bar is visible when the toolbar is 201 // Set the pref to the bookmark bar is visible when the toolbar is
230 // first created. 202 // first created.
231 helper_.profile()->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); 203 helper_.profile()->GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true);
232 204
233 // Create a new bar (after the pref is set) 205 // Create a new bar (after the pref is set)
234 Browser* browser = helper_.browser(); 206 Browser* browser = helper_.browser();
235 bar_.reset( 207 bar_.reset(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 EXPECT_GT(popupFrame.right(), NSMaxX(locationFrame)); 245 EXPECT_GT(popupFrame.right(), NSMaxX(locationFrame));
274 246
275 // Make sure the popup frame is positioned above the bottom of the 247 // Make sure the popup frame is positioned above the bottom of the
276 // location bar. 248 // location bar.
277 EXPECT_GE(popupFrame.bottom(), NSMinY(locationFrame)); 249 EXPECT_GE(popupFrame.bottom(), NSMinY(locationFrame));
278 } 250 }
279 251
280 252
281 253
282 } // namespace 254 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698