Chromium Code Reviews

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

Issue 1412923009: Route touch-events for WebViewGuest directly to guest renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null pointer deref when guest is terminated. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 27083866f81ff1442bda724f05c1ab1c098b3803..8f93c153dbc7a07c483a9a15ea1e9faaa8d2fa62 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -49,10 +49,12 @@
#include "ui/resources/grit/webui_resources.h"
#if defined(USE_AURA)
+#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "ui/aura/test/window_event_dispatcher_test_api.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/events/event.h"
#endif // USE_AURA
namespace content {
@@ -523,13 +525,14 @@ void SimulateTapWithModifiersAt(WebContents* web_contents,
widget_host->ForwardGestureEvent(tap);
}
+#if defined(USE_AURA)
void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) {
- SyntheticWebTouchEvent touch;
- touch.PressPoint(point.x(), point.y());
- RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
- web_contents->GetRenderViewHost()->GetWidget());
- widget_host->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, point, 0, base::TimeDelta());
+ static_cast<RenderWidgetHostViewAura*>(
+ web_contents->GetRenderWidgetHostView())
+ ->OnTouchEvent(&touch);
}
+#endif
void SimulateKeyPress(WebContents* web_contents,
ui::KeyboardCode key_code,

Powered by Google App Engine