| Index: Source/web/tests/WebViewTest.cpp
|
| diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
|
| index 12161bf0b7de101af17e113e257e6dbacc4e1db9..2aff9c81c2ec6a6e20109aee4dc9f243ea990b26 100644
|
| --- a/Source/web/tests/WebViewTest.cpp
|
| +++ b/Source/web/tests/WebViewTest.cpp
|
| @@ -1035,6 +1035,49 @@ TEST_F(WebViewTest, ClientTapHandling)
|
| m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
|
| }
|
|
|
| +static bool tapElementAndReturnWasHandled(WebView* webView, WebInputEvent::Type type, const WebString& id)
|
| +{
|
| + ASSERT(webView);
|
| + RefPtrWillBeRawPtr<WebCore::Element> element = static_cast<PassRefPtrWillBeRawPtr<WebCore::Element> >(webView->mainFrame()->document().getElementById(id));
|
| + ASSERT(element);
|
| +
|
| + element->scrollIntoViewIfNeeded();
|
| + WebCore::IntPoint center = element->screenRect().center();
|
| +
|
| + WebGestureEvent event;
|
| + event.type = type;
|
| + event.x = center.x();
|
| + event.y = center.y();
|
| +
|
| + bool handled = webView->handleInputEvent(event);
|
| + runPendingTasks();
|
| + return handled;
|
| +}
|
| +
|
| +TEST_F(WebViewTest, TapHandled)
|
| +{
|
| + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("tap_handled.html"));
|
| + TapHandlingWebViewClient client;
|
| + WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "tap_handled.html", true, 0, &client);
|
| +
|
| + webView->resize(WebSize(500, 300));
|
| + webView->layout();
|
| + runPendingTasks();
|
| +
|
| + WebString staticText = WebString::fromUTF8("static");
|
| + WebString editable = WebString::fromUTF8("editable");
|
| + WebString consumes = WebString::fromUTF8("consumes");
|
| + WebString ignores = WebString::fromUTF8("ignores");
|
| +
|
| + EXPECT_FALSE(tapElementAndReturnWasHandled(webView, WebInputEvent::GestureTap, staticText));
|
| + EXPECT_TRUE(tapElementAndReturnWasHandled(webView, WebInputEvent::GestureTap, editable));
|
| + EXPECT_FALSE(tapElementAndReturnWasHandled(webView, WebInputEvent::GestureTap, consumes));
|
| + EXPECT_FALSE(tapElementAndReturnWasHandled(webView, WebInputEvent::GestureTap, ignores));
|
| +
|
| + m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
|
| +}
|
| +
|
| +
|
| #if OS(ANDROID)
|
| TEST_F(WebViewTest, LongPressSelection)
|
| {
|
|
|