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

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

Issue 155444: Mac pop-up window happier-ness.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 TEST_F(ToolbarControllerTest, InitialState) { 67 TEST_F(ToolbarControllerTest, InitialState) {
68 CommandUpdater* updater = helper_.browser()->command_updater(); 68 CommandUpdater* updater = helper_.browser()->command_updater();
69 CompareState(updater, [bar_ toolbarViews]); 69 CompareState(updater, [bar_ toolbarViews]);
70 } 70 }
71 71
72 // Make sure awakeFromNib created a bookmarkBarController 72 // Make sure awakeFromNib created a bookmarkBarController
73 TEST_F(ToolbarControllerTest, AwakeFromNibCreatesBMBController) { 73 TEST_F(ToolbarControllerTest, AwakeFromNibCreatesBMBController) {
74 EXPECT_TRUE([bar_ bookmarkBarController]); 74 EXPECT_TRUE([bar_ bookmarkBarController]);
75 } 75 }
76 76
77 // Make sure a "titlebar only" toolbar works
78 TEST_F(ToolbarControllerTest, TitlebarOnly) {
79 NSView* view = [bar_ view];
80 EXPECT_TRUE([bar_ bookmarkBarController]);
81
82 [bar_ setHasToolbar:NO];
83 EXPECT_NE(view, [bar_ view]);
84 EXPECT_FALSE([bar_ bookmarkBarController]);
85
86 [bar_ setHasToolbar:YES];
87 EXPECT_EQ(view, [bar_ view]);
88 EXPECT_TRUE([bar_ bookmarkBarController]);
89
90 // Leave it off to make sure that's fine
91 [bar_ setHasToolbar:NO];
92 }
93
77 94
78 // Make some changes to the enabled state of a few of the buttons and ensure 95 // Make some changes to the enabled state of a few of the buttons and ensure
79 // that we're still in sync. 96 // that we're still in sync.
80 TEST_F(ToolbarControllerTest, UpdateEnabledState) { 97 TEST_F(ToolbarControllerTest, UpdateEnabledState) {
81 CommandUpdater* updater = helper_.browser()->command_updater(); 98 CommandUpdater* updater = helper_.browser()->command_updater();
82 EXPECT_FALSE(updater->IsCommandEnabled(IDC_BACK)); 99 EXPECT_FALSE(updater->IsCommandEnabled(IDC_BACK));
83 EXPECT_FALSE(updater->IsCommandEnabled(IDC_FORWARD)); 100 EXPECT_FALSE(updater->IsCommandEnabled(IDC_FORWARD));
84 updater->UpdateCommandEnabled(IDC_BACK, true); 101 updater->UpdateCommandEnabled(IDC_BACK, true);
85 updater->UpdateCommandEnabled(IDC_FORWARD, true); 102 updater->UpdateCommandEnabled(IDC_FORWARD, true);
86 CompareState(updater, [bar_ toolbarViews]); 103 CompareState(updater, [bar_ toolbarViews]);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Toggle the pref and make sure the buttons changed state and the other 177 // Toggle the pref and make sure the buttons changed state and the other
161 // views moved (or in the case of the location bar, it changed width). 178 // views moved (or in the case of the location bar, it changed width).
162 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); 179 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons);
163 EXPECT_EQ(showButtons, [pageButton isHidden]); 180 EXPECT_EQ(showButtons, [pageButton isHidden]);
164 EXPECT_EQ(showButtons, [wrenchButton isHidden]); 181 EXPECT_EQ(showButtons, [wrenchButton isHidden]);
165 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); 182 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame]));
166 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); 183 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame]));
167 } 184 }
168 185
169 } // namespace 186 } // 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