| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "chrome/browser/ui/global_error/global_error.h" | 10 #include "chrome/browser/ui/global_error/global_error.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 TestWrenchMenuModel model(this, browser()); | 125 TestWrenchMenuModel model(this, browser()); |
| 126 int itemCount = model.GetItemCount(); | 126 int itemCount = model.GetItemCount(); |
| 127 | 127 |
| 128 // Verify it has items. The number varies by platform, so we don't check | 128 // Verify it has items. The number varies by platform, so we don't check |
| 129 // the exact number. | 129 // the exact number. |
| 130 EXPECT_GT(itemCount, 10); | 130 EXPECT_GT(itemCount, 10); |
| 131 | 131 |
| 132 // Execute a couple of the items and make sure it gets back to our delegate. | 132 // Execute a couple of the items and make sure it gets back to our delegate. |
| 133 // We can't use CountEnabledExecutable() here because the encoding menu's | 133 // We can't use CountEnabledExecutable() here because the encoding menu's |
| 134 // delegate is internal, it doesn't use the one we pass in. | 134 // delegate is internal, it doesn't use the one we pass in. |
| 135 model.ActivatedAt(0); | 135 // Note: The new menu has a spacing separator at the first slot. |
| 136 EXPECT_TRUE(model.IsEnabledAt(0)); | 136 model.ActivatedAt(1); |
| 137 EXPECT_TRUE(model.IsEnabledAt(1)); |
| 137 // Make sure to use the index that is not separator in all configurations. | 138 // Make sure to use the index that is not separator in all configurations. |
| 138 model.ActivatedAt(2); | 139 model.ActivatedAt(2); |
| 139 EXPECT_TRUE(model.IsEnabledAt(2)); | 140 EXPECT_TRUE(model.IsEnabledAt(2)); |
| 140 EXPECT_EQ(model.execute_count_, 2); | 141 EXPECT_EQ(model.execute_count_, 2); |
| 141 EXPECT_EQ(model.enable_count_, 2); | 142 EXPECT_EQ(model.enable_count_, 2); |
| 142 | 143 |
| 143 model.execute_count_ = 0; | 144 model.execute_count_ = 0; |
| 144 model.enable_count_ = 0; | 145 model.enable_count_ = 0; |
| 145 | 146 |
| 146 // Choose something from the bookmark submenu and make sure it makes it back | 147 // Choose something from the bookmark submenu and make sure it makes it back |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 197 |
| 197 class EncodingMenuModelTest : public BrowserWithTestWindowTest, | 198 class EncodingMenuModelTest : public BrowserWithTestWindowTest, |
| 198 public MenuModelTest { | 199 public MenuModelTest { |
| 199 }; | 200 }; |
| 200 | 201 |
| 201 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { | 202 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { |
| 202 EncodingMenuModel model(browser()); | 203 EncodingMenuModel model(browser()); |
| 203 ASSERT_EQ(NULL, chrome::GetActiveWebContents(browser())); | 204 ASSERT_EQ(NULL, chrome::GetActiveWebContents(browser())); |
| 204 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); | 205 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); |
| 205 } | 206 } |
| OLD | NEW |