OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/menus/menu_model.h" | |
6 #include "chrome/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
7 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
10 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
11 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/test/ui_test_utils.h" | 11 #include "chrome/test/ui_test_utils.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" |
14 #include "webkit/glue/context_menu.h" | 13 #include "webkit/glue/context_menu.h" |
15 | 14 |
16 using menus::MenuModel; | |
17 using WebKit::WebContextMenuData; | 15 using WebKit::WebContextMenuData; |
18 | 16 |
19 // This test class helps us sidestep platform-specific issues with popping up a | 17 // This test class helps us sidestep platform-specific issues with popping up a |
20 // real context menu, while still running through the actual code in | 18 // real context menu, while still running through the actual code in |
21 // RenderViewContextMenu where extension items get added and executed. | 19 // RenderViewContextMenu where extension items get added and executed. |
22 class TestRenderViewContextMenu : public RenderViewContextMenu { | 20 class TestRenderViewContextMenu : public RenderViewContextMenu { |
23 public: | 21 public: |
24 TestRenderViewContextMenu(TabContents* tab_contents, | 22 TestRenderViewContextMenu(TabContents* tab_contents, |
25 const ContextMenuParams& params) | 23 const ContextMenuParams& params) |
26 : RenderViewContextMenu(tab_contents, params) {} | 24 : RenderViewContextMenu(tab_contents, params) {} |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Check that a document url that should match the items' patterns appears. | 111 // Check that a document url that should match the items' patterns appears. |
114 params->frame_url = GURL("http://www.google.com"); | 112 params->frame_url = GURL("http://www.google.com"); |
115 ASSERT_TRUE(MenuHasItemWithTitle(*params, std::string("test_item1"))); | 113 ASSERT_TRUE(MenuHasItemWithTitle(*params, std::string("test_item1"))); |
116 ASSERT_TRUE(MenuHasItemWithTitle(*params, std::string("test_item2"))); | 114 ASSERT_TRUE(MenuHasItemWithTitle(*params, std::string("test_item2"))); |
117 | 115 |
118 // Now check for a non-matching url. | 116 // Now check for a non-matching url. |
119 params->frame_url = GURL("http://www.test.com"); | 117 params->frame_url = GURL("http://www.test.com"); |
120 ASSERT_FALSE(MenuHasItemWithTitle(*params, std::string("test_item1"))); | 118 ASSERT_FALSE(MenuHasItemWithTitle(*params, std::string("test_item1"))); |
121 ASSERT_FALSE(MenuHasItemWithTitle(*params, std::string("test_item2"))); | 119 ASSERT_FALSE(MenuHasItemWithTitle(*params, std::string("test_item2"))); |
122 } | 120 } |
OLD | NEW |