| OLD | NEW |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // Make sure a "titlebar only" toolbar works | 78 // Make sure a "titlebar only" toolbar works |
| 79 TEST_F(ToolbarControllerTest, TitlebarOnly) { | 79 TEST_F(ToolbarControllerTest, TitlebarOnly) { |
| 80 NSView* view = [bar_ view]; | 80 NSView* view = [bar_ view]; |
| 81 EXPECT_TRUE([bar_ bookmarkBarController]); | 81 EXPECT_TRUE([bar_ bookmarkBarController]); |
| 82 | 82 |
| 83 [bar_ setHasToolbar:NO]; | 83 [bar_ setHasToolbar:NO]; |
| 84 EXPECT_NE(view, [bar_ view]); | 84 EXPECT_NE(view, [bar_ view]); |
| 85 EXPECT_FALSE([bar_ bookmarkBarController]); | 85 EXPECT_FALSE([bar_ bookmarkBarController]); |
| 86 | 86 |
| 87 // Simulate a popup going fullscreen and back. |
| 88 NSView* superview = [view superview]; |
| 89 // TODO(jrg): find a way to add an [NSAutoreleasePool drain] in |
| 90 // here. I don't have access to the current |
| 91 // scoped_nsautorelease_pool to do it properly :-( |
| 92 [view removeFromSuperview]; |
| 93 [superview addSubview:view]; |
| 94 |
| 87 [bar_ setHasToolbar:YES]; | 95 [bar_ setHasToolbar:YES]; |
| 88 EXPECT_EQ(view, [bar_ view]); | 96 EXPECT_EQ(view, [bar_ view]); |
| 89 EXPECT_TRUE([bar_ bookmarkBarController]); | 97 EXPECT_TRUE([bar_ bookmarkBarController]); |
| 90 | 98 |
| 91 // Leave it off to make sure that's fine | 99 // Leave it off to make sure that's fine |
| 92 [bar_ setHasToolbar:NO]; | 100 [bar_ setHasToolbar:NO]; |
| 93 } | 101 } |
| 94 | 102 |
| 95 | 103 |
| 96 // Make some changes to the enabled state of a few of the buttons and ensure | 104 // Make some changes to the enabled state of a few of the buttons and ensure |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Toggle the pref and make sure the buttons changed state and the other | 186 // Toggle the pref and make sure the buttons changed state and the other |
| 179 // views moved (or in the case of the location bar, it changed width). | 187 // views moved (or in the case of the location bar, it changed width). |
| 180 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); | 188 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); |
| 181 EXPECT_EQ(showButtons, [pageButton isHidden]); | 189 EXPECT_EQ(showButtons, [pageButton isHidden]); |
| 182 EXPECT_EQ(showButtons, [wrenchButton isHidden]); | 190 EXPECT_EQ(showButtons, [wrenchButton isHidden]); |
| 183 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); | 191 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); |
| 184 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); | 192 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); |
| 185 } | 193 } |
| 186 | 194 |
| 187 } // namespace | 195 } // namespace |
| OLD | NEW |