| 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 params.link_url = link_url; | 120 params.link_url = link_url; |
| 121 params.frame_url = frame_url; | 121 params.frame_url = frame_url; |
| 122 TestRenderViewContextMenu* menu = | 122 TestRenderViewContextMenu* menu = |
| 123 new TestRenderViewContextMenu(web_contents, params); | 123 new TestRenderViewContextMenu(web_contents, params); |
| 124 menu->Init(); | 124 menu->Init(); |
| 125 return menu; | 125 return menu; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Shortcut to return the current MenuManager. | 128 // Shortcut to return the current MenuManager. |
| 129 extensions::MenuManager* menu_manager() { | 129 extensions::MenuManager* menu_manager() { |
| 130 return browser()->profile()->GetExtensionService()->menu_manager(); | 130 return extensions::MenuManager::Get(browser()->profile()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // Returns a pointer to the currently loaded extension with |name|, or null | 133 // Returns a pointer to the currently loaded extension with |name|, or null |
| 134 // if not found. | 134 // if not found. |
| 135 const extensions::Extension* GetExtensionNamed(std::string name) { | 135 const extensions::Extension* GetExtensionNamed(std::string name) { |
| 136 const ExtensionSet* extensions = | 136 const ExtensionSet* extensions = |
| 137 browser()->profile()->GetExtensionService()->extensions(); | 137 browser()->profile()->GetExtensionService()->extensions(); |
| 138 ExtensionSet::const_iterator i; | 138 ExtensionSet::const_iterator i; |
| 139 for (i = extensions->begin(); i != extensions->end(); ++i) { | 139 for (i = extensions->begin(); i != extensions->end(); ++i) { |
| 140 if ((*i)->name() == name) { | 140 if ((*i)->name() == name) { |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito")); | 659 ASSERT_TRUE(LoadContextMenuExtensionIncognito("incognito")); |
| 660 | 660 |
| 661 // Wait for the extension's processes to tell us they've created an item. | 661 // Wait for the extension's processes to tell us they've created an item. |
| 662 ASSERT_TRUE(created.WaitUntilSatisfied()); | 662 ASSERT_TRUE(created.WaitUntilSatisfied()); |
| 663 ASSERT_TRUE(created_incognito.WaitUntilSatisfied()); | 663 ASSERT_TRUE(created_incognito.WaitUntilSatisfied()); |
| 664 ASSERT_EQ(2u, GetItems().size()); | 664 ASSERT_EQ(2u, GetItems().size()); |
| 665 | 665 |
| 666 browser()->profile()->DestroyOffTheRecordProfile(); | 666 browser()->profile()->DestroyOffTheRecordProfile(); |
| 667 ASSERT_EQ(1u, GetItems().size()); | 667 ASSERT_EQ(1u, GetItems().size()); |
| 668 } | 668 } |
| OLD | NEW |