| 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" |
| 11 #import "chrome/browser/cocoa/toolbar_controller.h" | 11 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/common/pref_service.h" | 13 #include "chrome/common/pref_service.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class ToolbarControllerTest : public testing::Test { | 18 class ToolbarControllerTest : public testing::Test { |
| 19 public: | 19 public: |
| 20 | 20 |
| 21 // Indexes that match the ordering returned by the private ToolbarController | 21 // Indexes that match the ordering returned by the private ToolbarController |
| 22 // |-toolbarViews| method. | 22 // |-toolbarViews| method. |
| 23 enum { | 23 enum { |
| 24 kBackIndex, kForwardIndex, kReloadIndex, kHomeIndex, kStarIndex, kGoIndex, | 24 kBackIndex, kForwardIndex, kReloadIndex, kHomeIndex, kStarIndex, kGoIndex, |
| 25 kPageIndex, kWrenchIndex, kLocationIndex, kBookmarkIndex, | 25 kPageIndex, kWrenchIndex, kLocationIndex, |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 ToolbarControllerTest() { | 28 ToolbarControllerTest() { |
| 29 Browser* browser = helper_.browser(); | 29 Browser* browser = helper_.browser(); |
| 30 CommandUpdater* updater = browser->command_updater(); | 30 CommandUpdater* updater = browser->command_updater(); |
| 31 // The default state for the commands is true, set a couple to false to | 31 // The default state for the commands is true, set a couple to false to |
| 32 // ensure they get picked up correct on initialization | 32 // ensure they get picked up correct on initialization |
| 33 updater->UpdateCommandEnabled(IDC_BACK, false); | 33 updater->UpdateCommandEnabled(IDC_BACK, false); |
| 34 updater->UpdateCommandEnabled(IDC_FORWARD, false); | 34 updater->UpdateCommandEnabled(IDC_FORWARD, false); |
| 35 bar_.reset( | 35 bar_.reset( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Toggle the pref and make sure the buttons changed state and the other | 160 // 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). | 161 // views moved (or in the case of the location bar, it changed width). |
| 162 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); | 162 prefs->SetBoolean(prefs::kShowPageOptionsButtons, !showButtons); |
| 163 EXPECT_EQ(showButtons, [pageButton isHidden]); | 163 EXPECT_EQ(showButtons, [pageButton isHidden]); |
| 164 EXPECT_EQ(showButtons, [wrenchButton isHidden]); | 164 EXPECT_EQ(showButtons, [wrenchButton isHidden]); |
| 165 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); | 165 EXPECT_NE(NSMinX(originalGoFrame), NSMinX([goButton frame])); |
| 166 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); | 166 EXPECT_NE(NSWidth(originalLocationBarFrame), NSWidth([locationBar frame])); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace | 169 } // namespace |
| OLD | NEW |