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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 extensions::MenuManager::Get(browser()->profile()); | 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 extensions::ExtensionSet* extensions = |
137 browser()->profile()->GetExtensionService()->extensions(); | 137 browser()->profile()->GetExtensionService()->extensions(); |
138 ExtensionSet::const_iterator i; | 138 for (extensions::ExtensionSet::const_iterator i = extensions->begin(); |
139 for (i = extensions->begin(); i != extensions->end(); ++i) { | 139 i != extensions->end(); ++i) { |
140 if ((*i)->name() == name) { | 140 if ((*i)->name() == name) { |
141 return i->get(); | 141 return i->get(); |
142 } | 142 } |
143 } | 143 } |
144 return NULL; | 144 return NULL; |
145 } | 145 } |
146 | 146 |
147 // This gets all the items that any extension has registered for possible | 147 // This gets all the items that any extension has registered for possible |
148 // inclusion in context menus. | 148 // inclusion in context menus. |
149 MenuItem::List GetItems() { | 149 MenuItem::List GetItems() { |
(...skipping 509 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 |