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

Side by Side Diff: third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp

Issue 2650403006: Remove PlatformMouseEvent and use WebMouseEvent instead (Closed)
Patch Set: Fix nits Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 "core/page/ContextMenuController.h" 5 #include "core/page/ContextMenuController.h"
6 6
7 #include "core/clipboard/DataTransfer.h" 7 #include "core/clipboard/DataTransfer.h"
8 #include "core/events/MouseEvent.h" 8 #include "core/events/MouseEvent.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" " 69 "<menuitem id=\"item10\" type=\"radio\" radiogroup=\"group\" "
70 "label=\"Item10\"" 70 "label=\"Item10\""
71 "onclick='if " 71 "onclick='if "
72 "(document.getElementById(\"item10\").hasAttribute(\"checked\"))" 72 "(document.getElementById(\"item10\").hasAttribute(\"checked\"))"
73 "document.title = \"Title 10 checked\"; else if " 73 "document.title = \"Title 10 checked\"; else if "
74 "(document.getElementById(\"item8\").hasAttribute(\"checked\"))" 74 "(document.getElementById(\"item8\").hasAttribute(\"checked\"))"
75 "document.title = \"Title 10 not checked and Title 8 checked\";'>" 75 "document.title = \"Title 10 not checked and Title 8 checked\";'>"
76 "</menu>" 76 "</menu>"
77 "</button>"); 77 "</button>");
78 78
79 MouseEventInit mouseInitializer;
80 mouseInitializer.setView(document().domWindow());
81 mouseInitializer.setScreenX(50);
82 mouseInitializer.setScreenY(50);
83 mouseInitializer.setButton(1);
84
79 // Create right button click event and pass it to context menu controller. 85 // Create right button click event and pass it to context menu controller.
80 Event* event = MouseEvent::create( 86 Event* event =
81 EventTypeNames::click, false, false, document().domWindow(), 50, 50, 0, 0, 87 MouseEvent::create(nullptr, EventTypeNames::click, mouseInitializer);
82 0, 0, 0, PlatformEvent::NoModifiers, 1, 0, nullptr, TimeTicks(),
83 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr);
84 document().getElementById("button_id")->focus(); 88 document().getElementById("button_id")->focus();
85 event->setTarget(document().getElementById("button_id")); 89 event->setTarget(document().getElementById("button_id"));
86 document().page()->contextMenuController().handleContextMenuEvent(event); 90 document().page()->contextMenuController().handleContextMenuEvent(event);
87 91
88 // Item 1 92 // Item 1
89 // Item 2 93 // Item 2
90 // Item 3 94 // Item 3
91 // Submenu > Item 4 95 // Submenu > Item 4
92 // Item 5 96 // Item 5
93 // Item 6 97 // Item 6
(...skipping 22 matching lines...) Expand all
116 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data()); 120 EXPECT_STREQ("Title 7 not checked", document().title().utf8().data());
117 document().page()->contextMenuController().contextMenuItemSelected(&items[5]); 121 document().page()->contextMenuController().contextMenuItemSelected(&items[5]);
118 EXPECT_STREQ("Title 8 not checked and Title 9 checked", 122 EXPECT_STREQ("Title 8 not checked and Title 9 checked",
119 document().title().utf8().data()); 123 document().title().utf8().data());
120 document().page()->contextMenuController().contextMenuItemSelected(&items[7]); 124 document().page()->contextMenuController().contextMenuItemSelected(&items[7]);
121 EXPECT_STREQ("Title 10 not checked and Title 8 checked", 125 EXPECT_STREQ("Title 10 not checked and Title 8 checked",
122 document().title().utf8().data()); 126 document().title().utf8().data());
123 } 127 }
124 128
125 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/AutoscrollController.cpp ('k') | third_party/WebKit/Source/core/page/DragController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698