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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 params.media_type = blink::WebContextMenuData::MediaTypeCanvas; | 82 params.media_type = blink::WebContextMenuData::MediaTypeCanvas; |
83 | 83 |
84 TestRenderViewContextMenu menu( | 84 TestRenderViewContextMenu menu( |
85 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(), | 85 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(), |
86 params); | 86 params); |
87 menu.Init(); | 87 menu.Init(); |
88 | 88 |
89 ASSERT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_SAVEIMAGEAS)); | 89 ASSERT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_SAVEIMAGEAS)); |
90 } | 90 } |
91 | 91 |
92 // GTK requires a X11-level mouse event to open a context menu correctly. | |
93 #if defined(TOOLKIT_GTK) | |
94 #define MAYBE_RealMenu DISABLED_RealMenu | |
95 #else | |
96 #define MAYBE_RealMenu RealMenu | |
97 #endif | |
98 // Opens a link in a new tab via a "real" context menu. | 92 // Opens a link in a new tab via a "real" context menu. |
99 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, | 93 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, RealMenu) { |
100 MAYBE_RealMenu) { | |
101 ContextMenuNotificationObserver menu_observer( | 94 ContextMenuNotificationObserver menu_observer( |
102 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); | 95 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); |
103 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( | 96 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( |
104 content::NotificationService::AllSources()); | 97 content::NotificationService::AllSources()); |
105 | 98 |
106 // Go to a page with a link | 99 // Go to a page with a link |
107 ui_test_utils::NavigateToURL( | 100 ui_test_utils::NavigateToURL( |
108 browser(), GURL("data:text/html,<a href='about:blank'>link</a>")); | 101 browser(), GURL("data:text/html,<a href='about:blank'>link</a>")); |
109 | 102 |
110 // Open a context menu. | 103 // Open a context menu. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 menu.Init(); | 248 menu.Init(); |
256 | 249 |
257 // The item shouldn't be enabled in the menu. | 250 // The item shouldn't be enabled in the menu. |
258 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO)); | 251 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO)); |
259 | 252 |
260 // Ensure that viewing page info doesn't crash even if you can get to it. | 253 // Ensure that viewing page info doesn't crash even if you can get to it. |
261 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0); | 254 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0); |
262 } | 255 } |
263 | 256 |
264 } // namespace | 257 } // namespace |
OLD | NEW |