| 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/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_menu_model.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 TEST_F(AppMenuModelTest, Basics) { | 121 TEST_F(AppMenuModelTest, Basics) { |
| 122 TestAppMenuModel model(this, browser()); | 122 TestAppMenuModel model(this, browser()); |
| 123 int itemCount = model.GetItemCount(); | 123 int itemCount = model.GetItemCount(); |
| 124 | 124 |
| 125 // Verify it has items. The number varies by platform, so we don't check | 125 // Verify it has items. The number varies by platform, so we don't check |
| 126 // the exact number. | 126 // the exact number. |
| 127 EXPECT_GT(itemCount, 10); | 127 EXPECT_GT(itemCount, 10); |
| 128 | 128 |
| 129 UpgradeDetector* detector = UpgradeDetector::GetInstance(); | 129 UpgradeDetector* detector = UpgradeDetector::GetInstance(); |
| 130 detector->NotifyUpgradeRecommended(); | 130 detector->NotifyUpgrade(); |
| 131 EXPECT_TRUE(detector->notify_upgrade()); | 131 EXPECT_TRUE(detector->notify_upgrade()); |
| 132 EXPECT_EQ(browser_defaults::kShowUpgradeMenuItem, | 132 EXPECT_EQ(browser_defaults::kShowUpgradeMenuItem, |
| 133 model.IsCommandIdVisible(IDC_UPGRADE_DIALOG)); | 133 model.IsCommandIdVisible(IDC_UPGRADE_DIALOG)); |
| 134 | 134 |
| 135 // Execute a couple of the items and make sure it gets back to our delegate. | 135 // Execute a couple of the items and make sure it gets back to our delegate. |
| 136 // We can't use CountEnabledExecutable() here because the encoding menu's | 136 // We can't use CountEnabledExecutable() here because the encoding menu's |
| 137 // delegate is internal, it doesn't use the one we pass in. | 137 // delegate is internal, it doesn't use the one we pass in. |
| 138 // Note: The new menu has a spacing separator at the first slot. | 138 // Note: The new menu has a spacing separator at the first slot. |
| 139 model.ActivatedAt(1); | 139 model.ActivatedAt(1); |
| 140 EXPECT_TRUE(model.IsEnabledAt(1)); | 140 EXPECT_TRUE(model.IsEnabledAt(1)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 EXPECT_TRUE(model.IsEnabledAt(index1)); | 194 EXPECT_TRUE(model.IsEnabledAt(index1)); |
| 195 EXPECT_EQ(0, error1->execute_count()); | 195 EXPECT_EQ(0, error1->execute_count()); |
| 196 model.ActivatedAt(index1); | 196 model.ActivatedAt(index1); |
| 197 EXPECT_EQ(1, error1->execute_count()); | 197 EXPECT_EQ(1, error1->execute_count()); |
| 198 | 198 |
| 199 EXPECT_TRUE(model.IsEnabledAt(index2)); | 199 EXPECT_TRUE(model.IsEnabledAt(index2)); |
| 200 EXPECT_EQ(0, error2->execute_count()); | 200 EXPECT_EQ(0, error2->execute_count()); |
| 201 model.ActivatedAt(index2); | 201 model.ActivatedAt(index2); |
| 202 EXPECT_EQ(1, error1->execute_count()); | 202 EXPECT_EQ(1, error1->execute_count()); |
| 203 } | 203 } |
| OLD | NEW |