| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_
H_ | 5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_
H_ |
| 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_
H_ | 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UTIL_
H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 9 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 class Browser; |
| 14 |
| 15 namespace content { |
| 16 class WebContents; |
| 17 } |
| 18 namespace ui { |
| 19 class MenuModel; |
| 20 } |
| 10 | 21 |
| 11 class TestRenderViewContextMenu : public RenderViewContextMenu { | 22 class TestRenderViewContextMenu : public RenderViewContextMenu { |
| 12 public: | 23 public: |
| 13 TestRenderViewContextMenu(content::RenderFrameHost* render_frame_host, | 24 TestRenderViewContextMenu(content::RenderFrameHost* render_frame_host, |
| 14 content::ContextMenuParams params); | 25 content::ContextMenuParams params); |
| 15 virtual ~TestRenderViewContextMenu(); | 26 virtual ~TestRenderViewContextMenu(); |
| 16 | 27 |
| 28 // Factory. |
| 29 static TestRenderViewContextMenu* Create(content::WebContents* web_contents, |
| 30 const GURL& page_url, |
| 31 const GURL& link_url, |
| 32 const GURL& frame_url); |
| 33 |
| 34 // Implementation of pure virtuals in RenderViewContextMenu. |
| 17 virtual void PlatformInit() OVERRIDE; | 35 virtual void PlatformInit() OVERRIDE; |
| 18 virtual void PlatformCancel() OVERRIDE; | 36 virtual void PlatformCancel() OVERRIDE; |
| 19 virtual bool GetAcceleratorForCommandId( | 37 virtual bool GetAcceleratorForCommandId( |
| 20 int command_id, | 38 int command_id, |
| 21 ui::Accelerator* accelerator) OVERRIDE; | 39 ui::Accelerator* accelerator) OVERRIDE; |
| 22 | 40 |
| 23 // Returns true if command specified by |command_id| is present | 41 // Returns true if command specified by |command_id| is present |
| 24 // in the menu. | 42 // in the menu. |
| 25 // List of command ids can be found in chrome/app/chrome_command_ids.h. | 43 // List of command ids can be found in chrome/app/chrome_command_ids.h. |
| 26 bool IsItemPresent(int command_id); | 44 bool IsItemPresent(int command_id); |
| 27 | 45 |
| 46 // Searches for an menu item with |command_id|. If it's found, the return |
| 47 // value is true and the model and index where it appears in that model are |
| 48 // returned in |found_model| and |found_index|. Otherwise returns false. |
| 49 bool GetMenuModelAndItemIndex(int command_id, |
| 50 ui::MenuModel** found_model, |
| 51 int* found_index); |
| 52 |
| 53 extensions::ContextMenuMatcher& extension_items() { return extension_items_; } |
| 54 |
| 28 private: | 55 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); | 56 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); |
| 30 }; | 57 }; |
| 31 | 58 |
| 32 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UT
IL_H_ | 59 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_TEST_UT
IL_H_ |
| OLD | NEW |