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

Unified Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 438193003: Updating MakeMenuItemStringsFor() to include custom items if provided by blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/event_sender.cc
diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc
index 8791a2f8c1dfb26b4a89dd7a1d54577c6a2faf3d..964ccdda2b680fe3ae3e885f775cedbb1c9a7d49 100644
--- a/content/shell/renderer/test_runner/event_sender.cc
+++ b/content/shell/renderer/test_runner/event_sender.cc
@@ -32,6 +32,7 @@ using blink::WebFrame;
using blink::WebGestureEvent;
using blink::WebInputEvent;
using blink::WebKeyboardEvent;
+using blink::WebMenuItemInfo;
using blink::WebMouseEvent;
using blink::WebMouseWheelEvent;
using blink::WebPoint;
@@ -127,6 +128,18 @@ bool OutsideMultiClickRadius(const WebPoint& a, const WebPoint& b) {
kMultipleClickRadiusPixels * kMultipleClickRadiusPixels;
}
+void PopulateCustomItems(const WebVector<WebMenuItemInfo>& customItems,
+ std::vector<std::string>& strings) {
+ for (size_t i = 0; i < customItems.size(); ++i) {
+ if (customItems[i].type == blink::WebMenuItemInfo::SubMenu) {
+ strings.push_back(customItems[i].label.utf8());
+ PopulateCustomItems(customItems[i].subMenuItems, strings);
tkent 2014/08/05 06:36:57 Let's prepend/append something to items for submen
pals 2014/08/05 08:38:08 Done.
+ } else {
+ strings.push_back(customItems[i].label.utf8());
+ }
+ }
+}
+
// Because actual context menu is implemented by the browser side,
// this function does only what LayoutTests are expecting:
// - Many test checks the count of items. So returning non-zero value makes
@@ -172,6 +185,9 @@ std::vector<std::string> MakeMenuItemStringsFor(
std::vector<std::string> strings;
+ // Populate custom menu items if provided by the WebCore internals.
+ PopulateCustomItems(context_menu->customItems, strings);
+
if (context_menu->isEditable) {
for (const char** item = kEditableMenuStrings; *item; ++item) {
strings.push_back(*item);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698