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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 EXPECT_FALSE(menu.IsCommandIdEnabled(ExtensionContextMenuModel::NAME)); | 263 EXPECT_FALSE(menu.IsCommandIdEnabled(ExtensionContextMenuModel::NAME)); |
264 } | 264 } |
265 | 265 |
266 { | 266 { |
267 // Check that a component extension with an options page does have the | 267 // Check that a component extension with an options page does have the |
268 // options | 268 // options |
269 // menu item, and it is enabled. | 269 // menu item, and it is enabled. |
270 manifest->SetString("options_page", "options_page.html"); | 270 manifest->SetString("options_page", "options_page.html"); |
271 scoped_refptr<const Extension> extension = | 271 scoped_refptr<const Extension> extension = |
272 ExtensionBuilder() | 272 ExtensionBuilder() |
273 .SetManifest(manifest.Pass()) | 273 .SetManifest(std::move(manifest)) |
274 .SetID(crx_file::id_util::GenerateId("component_opts")) | 274 .SetID(crx_file::id_util::GenerateId("component_opts")) |
275 .SetLocation(Manifest::COMPONENT) | 275 .SetLocation(Manifest::COMPONENT) |
276 .Build(); | 276 .Build(); |
277 ExtensionContextMenuModel menu(extension.get(), GetBrowser(), | 277 ExtensionContextMenuModel menu(extension.get(), GetBrowser(), |
278 ExtensionContextMenuModel::VISIBLE, nullptr); | 278 ExtensionContextMenuModel::VISIBLE, nullptr); |
279 service()->AddExtension(extension.get()); | 279 service()->AddExtension(extension.get()); |
280 EXPECT_TRUE(extensions::OptionsPageInfo::HasOptionsPage(extension.get())); | 280 EXPECT_TRUE(extensions::OptionsPageInfo::HasOptionsPage(extension.get())); |
281 EXPECT_NE(-1, | 281 EXPECT_NE(-1, |
282 menu.GetIndexOfCommandId(ExtensionContextMenuModel::CONFIGURE)); | 282 menu.GetIndexOfCommandId(ExtensionContextMenuModel::CONFIGURE)); |
283 EXPECT_TRUE(menu.IsCommandIdEnabled(ExtensionContextMenuModel::CONFIGURE)); | 283 EXPECT_TRUE(menu.IsCommandIdEnabled(ExtensionContextMenuModel::CONFIGURE)); |
(...skipping 368 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 |