| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 class PanelContextMenu : public RenderViewContextMenu { | 116 class PanelContextMenu : public RenderViewContextMenu { |
| 117 public: | 117 public: |
| 118 PanelContextMenu(content::RenderFrameHost* render_frame_host, | 118 PanelContextMenu(content::RenderFrameHost* render_frame_host, |
| 119 const content::ContextMenuParams& params) | 119 const content::ContextMenuParams& params) |
| 120 : RenderViewContextMenu(render_frame_host, params) {} | 120 : RenderViewContextMenu(render_frame_host, params) {} |
| 121 | 121 |
| 122 bool HasCommandWithId(int command_id) { | 122 bool HasCommandWithId(int command_id) { |
| 123 return menu_model_.GetIndexOfCommandId(command_id) != -1; | 123 return menu_model_.GetIndexOfCommandId(command_id) != -1; |
| 124 } | 124 } |
| 125 | 125 |
| 126 // RenderViewContextMenuBase implementation. |
| 127 void CalculateScreenCoordinatesInParams() override {}; |
| 128 void Show() override {} |
| 129 |
| 126 protected: | 130 protected: |
| 127 // RenderViewContextMenu implementation. | 131 // RenderViewContextMenu implementation. |
| 128 bool GetAcceleratorForCommandId(int command_id, | 132 bool GetAcceleratorForCommandId(int command_id, |
| 129 ui::Accelerator* accelerator) override { | 133 ui::Accelerator* accelerator) override { |
| 130 return false; | 134 return false; |
| 131 } | 135 } |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, BasicContextMenu) { | 138 IN_PROC_BROWSER_TEST_F(PanelExtensionBrowserTest, BasicContextMenu) { |
| 135 ExtensionTestMessageListener listener("panel loaded", false); | 139 ExtensionTestMessageListener listener("panel loaded", false); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); | 271 EXPECT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); |
| 268 | 272 |
| 269 // Execute the extension's custom menu item and wait for the extension's | 273 // Execute the extension's custom menu item and wait for the extension's |
| 270 // script to tell us its onclick fired. | 274 // script to tell us its onclick fired. |
| 271 ExtensionTestMessageListener onclick_listener("clicked", false); | 275 ExtensionTestMessageListener onclick_listener("clicked", false); |
| 272 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; | 276 int command_id = IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST; |
| 273 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); | 277 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); |
| 274 menu->ExecuteCommand(command_id, 0); | 278 menu->ExecuteCommand(command_id, 0); |
| 275 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); | 279 EXPECT_TRUE(onclick_listener.WaitUntilSatisfied()); |
| 276 } | 280 } |
| OLD | NEW |