| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/global_error.h" | 9 #include "chrome/browser/ui/global_error.h" |
| 10 #include "chrome/browser/ui/global_error_service.h" | 10 #include "chrome/browser/ui/global_error_service.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int bookmarksModelIndex = -1; | 142 int bookmarksModelIndex = -1; |
| 143 for (int i = 0; i < itemCount; ++i) { | 143 for (int i = 0; i < itemCount; ++i) { |
| 144 if (model.GetTypeAt(i) == ui::MenuModel::TYPE_SUBMENU) { | 144 if (model.GetTypeAt(i) == ui::MenuModel::TYPE_SUBMENU) { |
| 145 bookmarksModelIndex = i; | 145 bookmarksModelIndex = i; |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 EXPECT_GT(bookmarksModelIndex, -1); | 149 EXPECT_GT(bookmarksModelIndex, -1); |
| 150 ui::MenuModel* bookmarksModel = model.GetSubmenuModelAt(bookmarksModelIndex); | 150 ui::MenuModel* bookmarksModel = model.GetSubmenuModelAt(bookmarksModelIndex); |
| 151 EXPECT_TRUE(bookmarksModel); | 151 EXPECT_TRUE(bookmarksModel); |
| 152 // The bookmarks model may be empty until we tell it we're going to show it. |
| 153 bookmarksModel->MenuWillShow(); |
| 152 EXPECT_GT(bookmarksModel->GetItemCount(), 1); | 154 EXPECT_GT(bookmarksModel->GetItemCount(), 1); |
| 153 bookmarksModel->ActivatedAt(1); | 155 bookmarksModel->ActivatedAt(1); |
| 154 EXPECT_TRUE(bookmarksModel->IsEnabledAt(1)); | 156 EXPECT_TRUE(bookmarksModel->IsEnabledAt(1)); |
| 155 EXPECT_EQ(model.execute_count_, 1); | 157 EXPECT_EQ(model.execute_count_, 1); |
| 156 EXPECT_EQ(model.enable_count_, 1); | 158 EXPECT_EQ(model.enable_count_, 1); |
| 157 } | 159 } |
| 158 | 160 |
| 159 // Tests global error menu items in the wrench menu. | 161 // Tests global error menu items in the wrench menu. |
| 160 TEST_F(WrenchMenuModelTest, GlobalError) { | 162 TEST_F(WrenchMenuModelTest, GlobalError) { |
| 161 GlobalErrorService* service = | 163 GlobalErrorService* service = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 188 | 190 |
| 189 class EncodingMenuModelTest : public BrowserWithTestWindowTest, | 191 class EncodingMenuModelTest : public BrowserWithTestWindowTest, |
| 190 public MenuModelTest { | 192 public MenuModelTest { |
| 191 }; | 193 }; |
| 192 | 194 |
| 193 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { | 195 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { |
| 194 EncodingMenuModel model(browser()); | 196 EncodingMenuModel model(browser()); |
| 195 ASSERT_EQ(NULL, browser()->GetSelectedTabContents()); | 197 ASSERT_EQ(NULL, browser()->GetSelectedTabContents()); |
| 196 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); | 198 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); |
| 197 } | 199 } |
| OLD | NEW |