| 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/defaults.h" | 8 #include "chrome/browser/defaults.h" |
| 9 #include "chrome/browser/prefs/browser_prefs.h" | 9 #include "chrome/browser/prefs/browser_prefs.h" |
| 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 EXPECT_EQ(model.enable_count_, 2); | 147 EXPECT_EQ(model.enable_count_, 2); |
| 148 | 148 |
| 149 model.execute_count_ = 0; | 149 model.execute_count_ = 0; |
| 150 model.enable_count_ = 0; | 150 model.enable_count_ = 0; |
| 151 | 151 |
| 152 // Choose something from the bookmark submenu and make sure it makes it back | 152 // Choose something from the bookmark submenu and make sure it makes it back |
| 153 // to the delegate as well. | 153 // to the delegate as well. |
| 154 int bookmarksModelIndex = -1; | 154 int bookmarksModelIndex = -1; |
| 155 for (int i = 0; i < itemCount; ++i) { | 155 for (int i = 0; i < itemCount; ++i) { |
| 156 if (model.GetTypeAt(i) == ui::MenuModel::TYPE_SUBMENU) { | 156 if (model.GetTypeAt(i) == ui::MenuModel::TYPE_SUBMENU) { |
| 157 // Tabs is the first submenu item. Bookmarks submenu is under tabs. | 157 // Tabs is the first submenu item followed by downloads then the |
| 158 bookmarksModelIndex = i + 1; | 158 // Bookmarks submenu. |
| 159 bookmarksModelIndex = i + 2; |
| 159 break; | 160 break; |
| 160 } | 161 } |
| 161 } | 162 } |
| 162 EXPECT_GT(bookmarksModelIndex, -1); | 163 EXPECT_GT(bookmarksModelIndex, -1); |
| 163 ui::MenuModel* bookmarksModel = model.GetSubmenuModelAt(bookmarksModelIndex); | 164 ui::MenuModel* bookmarksModel = model.GetSubmenuModelAt(bookmarksModelIndex); |
| 164 EXPECT_TRUE(bookmarksModel); | 165 EXPECT_TRUE(bookmarksModel); |
| 165 // The bookmarks model may be empty until we tell it we're going to show it. | 166 // The bookmarks model may be empty until we tell it we're going to show it. |
| 166 bookmarksModel->MenuWillShow(); | 167 bookmarksModel->MenuWillShow(); |
| 167 EXPECT_GT(bookmarksModel->GetItemCount(), 1); | 168 EXPECT_GT(bookmarksModel->GetItemCount(), 1); |
| 168 | 169 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 208 |
| 208 class EncodingMenuModelTest : public BrowserWithTestWindowTest, | 209 class EncodingMenuModelTest : public BrowserWithTestWindowTest, |
| 209 public MenuModelTest { | 210 public MenuModelTest { |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { | 213 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { |
| 213 EncodingMenuModel model(browser()); | 214 EncodingMenuModel model(browser()); |
| 214 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); | 215 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); |
| 215 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); | 216 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); |
| 216 } | 217 } |
| OLD | NEW |