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

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

Issue 297693002: Tests for "WebView: speed up user gesture notification for GestureTap" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Limit test to Aura Created 6 years, 7 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/browser_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60b2b0eb50b96bb19df33baca012e78cfcf91a07..fa2c79996dbd61094cd2eb298758820931e46628 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -14,7 +14,9 @@
#include "base/synchronization/waitable_event.h"
#include "base/test/test_timeouts.h"
#include "base/values.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_view.h"
+#include "content/common/input/synthetic_web_input_event_builders.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -33,6 +35,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/events/gestures/gesture_configuration.h"
#include "ui/events/keycodes/dom4/keycode_converter.h"
namespace content {
@@ -256,6 +259,23 @@ void SimulateMouseEvent(WebContents* web_contents,
web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
}
+void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) {
+ const double kTapDurationSeconds =
+ 0.5 * (ui::GestureConfiguration::
+ min_touch_down_duration_in_seconds_for_click() +
+ ui::GestureConfiguration::
+ max_touch_down_duration_in_seconds_for_click());
+ SyntheticWebTouchEvent touch;
+ touch.timeStampSeconds = 0;
+ touch.PressPoint(point.x(), point.y());
+ RenderWidgetHostImpl* widget_host =
+ RenderWidgetHostImpl::From(web_contents->GetRenderViewHost());
+ widget_host->ForwardTouchEvent(touch);
+ touch.timeStampSeconds = kTapDurationSeconds;
+ touch.ReleasePoint(0);
+ widget_host->ForwardTouchEvent(touch);
+}
+
void SimulateKeyPress(WebContents* web_contents,
ui::KeyboardCode key_code,
bool control,
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698