| 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/utf_string_conversions.h" | 5 #include "base/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_context_menu_model.h" | 8 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 std::string subdirectory) { | 136 std::string subdirectory) { |
| 137 FilePath extension_dir = | 137 FilePath extension_dir = |
| 138 test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory); | 138 test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory); |
| 139 return LoadExtensionIncognito(extension_dir); | 139 return LoadExtensionIncognito(extension_dir); |
| 140 } | 140 } |
| 141 | 141 |
| 142 TestRenderViewContextMenu* CreateMenu(Browser* browser, | 142 TestRenderViewContextMenu* CreateMenu(Browser* browser, |
| 143 const GURL& page_url, | 143 const GURL& page_url, |
| 144 const GURL& link_url, | 144 const GURL& link_url, |
| 145 const GURL& frame_url) { | 145 const GURL& frame_url) { |
| 146 WebContents* web_contents = browser->GetSelectedWebContents(); | 146 WebContents* web_contents = browser->GetActiveWebContents(); |
| 147 WebContextMenuData data; | 147 WebContextMenuData data; |
| 148 content::ContextMenuParams params(data); | 148 content::ContextMenuParams params(data); |
| 149 params.page_url = page_url; | 149 params.page_url = page_url; |
| 150 params.link_url = link_url; | 150 params.link_url = link_url; |
| 151 params.frame_url = frame_url; | 151 params.frame_url = frame_url; |
| 152 TestRenderViewContextMenu* menu = | 152 TestRenderViewContextMenu* menu = |
| 153 new TestRenderViewContextMenu(web_contents, params); | 153 new TestRenderViewContextMenu(web_contents, params); |
| 154 menu->Init(); | 154 menu->Init(); |
| 155 return menu; | 155 return menu; |
| 156 } | 156 } |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 EXPECT_FALSE(menu->IsCommandIdChecked(command_id)); | 585 EXPECT_FALSE(menu->IsCommandIdChecked(command_id)); |
| 586 | 586 |
| 587 // Executing the checkbox also fires the onClicked event. | 587 // Executing the checkbox also fires the onClicked event. |
| 588 ExtensionTestMessageListener listener("onClicked fired for checkbox1", false); | 588 ExtensionTestMessageListener listener("onClicked fired for checkbox1", false); |
| 589 menu->ExecuteCommand(command_id); | 589 menu->ExecuteCommand(command_id); |
| 590 checkbox_checked.WaitUntilClosed(); | 590 checkbox_checked.WaitUntilClosed(); |
| 591 | 591 |
| 592 EXPECT_TRUE(menu->IsCommandIdChecked(command_id)); | 592 EXPECT_TRUE(menu->IsCommandIdChecked(command_id)); |
| 593 ASSERT_TRUE(listener.WaitUntilSatisfied()); | 593 ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| 594 } | 594 } |
| OLD | NEW |