| 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/extensions/extension_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 .SetLocation(location) | 171 .SetLocation(location) |
| 172 .Build(); | 172 .Build(); |
| 173 if (!extension.get()) | 173 if (!extension.get()) |
| 174 ADD_FAILURE(); | 174 ADD_FAILURE(); |
| 175 service()->AddExtension(extension.get()); | 175 service()->AddExtension(extension.get()); |
| 176 return extension.get(); | 176 return extension.get(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 Browser* ExtensionContextMenuModelTest::GetBrowser() { | 179 Browser* ExtensionContextMenuModelTest::GetBrowser() { |
| 180 if (!browser_) { | 180 if (!browser_) { |
| 181 Browser::CreateParams params(profile(), chrome::GetActiveDesktop()); | 181 Browser::CreateParams params(profile()); |
| 182 test_window_.reset(new TestBrowserWindow()); | 182 test_window_.reset(new TestBrowserWindow()); |
| 183 params.window = test_window_.get(); | 183 params.window = test_window_.get(); |
| 184 browser_.reset(new Browser(params)); | 184 browser_.reset(new Browser(params)); |
| 185 } | 185 } |
| 186 return browser_.get(); | 186 return browser_.get(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Tests that applicable menu items are disabled when a ManagementPolicy | 189 // Tests that applicable menu items are disabled when a ManagementPolicy |
| 190 // prohibits them. | 190 // prohibits them. |
| 191 TEST_F(ExtensionContextMenuModelTest, RequiredInstallationsDisablesItems) { | 191 TEST_F(ExtensionContextMenuModelTest, RequiredInstallationsDisablesItems) { |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 "feature_disabled_extension", manifest_keys::kBrowserAction, | 652 "feature_disabled_extension", manifest_keys::kBrowserAction, |
| 653 Manifest::INTERNAL, "http://www.google.com/*"); | 653 Manifest::INTERNAL, "http://www.google.com/*"); |
| 654 ExtensionContextMenuModel feature_disabled_menu( | 654 ExtensionContextMenuModel feature_disabled_menu( |
| 655 feature_disabled_extension, GetBrowser(), | 655 feature_disabled_extension, GetBrowser(), |
| 656 ExtensionContextMenuModel::VISIBLE, nullptr); | 656 ExtensionContextMenuModel::VISIBLE, nullptr); |
| 657 EXPECT_EQ(-1, feature_disabled_menu.GetIndexOfCommandId( | 657 EXPECT_EQ(-1, feature_disabled_menu.GetIndexOfCommandId( |
| 658 ExtensionContextMenuModel::PAGE_ACCESS_SUBMENU)); | 658 ExtensionContextMenuModel::PAGE_ACCESS_SUBMENU)); |
| 659 } | 659 } |
| 660 | 660 |
| 661 } // namespace extensions | 661 } // namespace extensions |
| OLD | NEW |