Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 1637743002: Identify context menus being opened via the long press gesture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the MENU_SOURCE_LONG_TAP context menu source type and ensure that it gets sent from blink in th… Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 374adaf7afa355201721d2b1742846e9d26a12b9..12266b34e9e209a609c7a9107738254296737b18 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -3756,12 +3756,32 @@ TEST_F(RenderWidgetHostViewAuraWithViewHarnessTest,
// A context menu request with the MENU_SOURCE_TOUCH source type should
// result in the MockWebContentsViewDelegate::ShowContextMenu method
- // getting called on non Windows platforms. This means that the request
- // worked correctly. On Windows this should be blocked.
+ // getting called on all platforms. This means that the request worked
+ // correctly.
delegate->ClearState();
context_menu_params.source_type = ui::MENU_SOURCE_TOUCH;
contents()->ShowContextMenu(contents()->GetRenderViewHost()->GetMainFrame(),
context_menu_params);
+ EXPECT_TRUE(delegate->context_menu_request_received());
+
+ // A context menu request with the MENU_SOURCE_LONG_TAP source type should
+ // result in the MockWebContentsViewDelegate::ShowContextMenu method
+ // getting called on all platforms. This means that the request worked
+ // correctly.
+ delegate->ClearState();
+ context_menu_params.source_type = ui::MENU_SOURCE_LONG_TAP;
+ contents()->ShowContextMenu(contents()->GetRenderViewHost()->GetMainFrame(),
+ context_menu_params);
+ EXPECT_TRUE(delegate->context_menu_request_received());
+
+ // A context menu request with the MENU_SOURCE_LONG_PRESS source type should
+ // result in the MockWebContentsViewDelegate::ShowContextMenu method
+ // getting called on non Windows platforms. This means that the request
+ // worked correctly. On Windows this should be blocked.
+ delegate->ClearState();
+ context_menu_params.source_type = ui::MENU_SOURCE_LONG_PRESS;
+ contents()->ShowContextMenu(contents()->GetRenderViewHost()->GetMainFrame(),
+ context_menu_params);
#if defined(OS_WIN)
EXPECT_FALSE(delegate->context_menu_request_received());
#else
@@ -3780,7 +3800,7 @@ TEST_F(RenderWidgetHostViewAuraWithViewHarnessTest,
view()->OnGestureEvent(&gesture_event);
EXPECT_TRUE(delegate->context_menu_request_received());
- EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_MOUSE);
+ EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH);
#endif
RenderViewHostFactory::set_is_real_render_view_host(false);

Powered by Google App Engine
This is Rietveld 408576698