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

Unified Diff: content/public/test/render_view_test.cc

Issue 1195473005: Let PageClickTracker use onMouseDown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 6 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 | « content/public/test/render_view_test.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/render_view_test.cc
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc
index 26262408d209638acbd11b9afa754e1adf29223f..c56cf3e6442ec6c81a81aca3e899010838ccb3c4 100644
--- a/content/public/test/render_view_test.cc
+++ b/content/public/test/render_view_test.cc
@@ -386,6 +386,30 @@ void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
}
+
+bool RenderViewTest::SimulateElementRightClick(const std::string& element_id) {
+ gfx::Rect bounds = GetElementBounds(element_id);
+ if (bounds.IsEmpty())
+ return false;
+ SimulatePointRightClick(bounds.CenterPoint());
+ return true;
+}
+
+void RenderViewTest::SimulatePointRightClick(const gfx::Point& point) {
+ WebMouseEvent mouse_event;
+ mouse_event.type = WebInputEvent::MouseDown;
+ mouse_event.button = WebMouseEvent::ButtonRight;
+ mouse_event.x = point.x();
+ mouse_event.y = point.y();
+ mouse_event.clickCount = 1;
+ RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
+ impl->OnMessageReceived(
+ InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
+ mouse_event.type = WebInputEvent::MouseUp;
+ impl->OnMessageReceived(
+ InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
+}
+
void RenderViewTest::SimulateRectTap(const gfx::Rect& rect) {
WebGestureEvent gesture_event;
gesture_event.x = rect.CenterPoint().x();
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698