Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / tests / TouchActionTest.cpp
index 9e0e093..52d22af 100644 (file)
 
 #include "config.h"
 
-#include "FrameTestHelpers.h"
 #include "RuntimeEnabledFeatures.h"
-#include "URLTestHelpers.h"
-#include "WebDocument.h"
-#include "WebFrame.h"
-#include "WebInputEvent.h"
-#include "WebView.h"
-#include "WebViewClient.h"
-#include "WebViewImpl.h"
 #include "core/dom/ClientRect.h"
 #include "core/dom/ClientRectList.h"
 #include "core/dom/Document.h"
 #include "core/rendering/RenderTreeAsText.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
+#include "public/web/WebDocument.h"
+#include "public/web/WebFrame.h"
 #include "public/web/WebHitTestResult.h"
+#include "public/web/WebInputEvent.h"
 #include "public/web/WebTouchAction.h"
+#include "public/web/WebView.h"
+#include "public/web/WebViewClient.h"
 #include "public/web/WebWidgetClient.h"
+#include "web/WebViewImpl.h"
+#include "web/tests/FrameTestHelpers.h"
+#include "web/tests/URLTestHelpers.h"
 
 #include <gtest/gtest.h>
 
@@ -62,7 +62,7 @@ using blink::FrameTestHelpers::runPendingTasks;
 
 namespace {
 
-class TouchActionTrackingWebViewClient : public WebViewClient {
+class TouchActionTrackingWebViewClient : public FrameTestHelpers::TestWebViewClient {
 public:
     TouchActionTrackingWebViewClient() :
         m_actionSetCount(0),
@@ -133,7 +133,7 @@ void TouchActionTest::runTouchActionTest(std::string file)
 
     WebView* webView = setupTest(file, client);
 
-    RefPtr<WebCore::Document> document = static_cast<PassRefPtr<WebCore::Document> >(webView->mainFrame()->document());
+    RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillBeRawPtr<WebCore::Document> >(webView->mainFrame()->document());
     runTestOnTree(document.get(), webView, client);
 
     m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
@@ -146,7 +146,7 @@ void TouchActionTest::runShadowDOMTest(std::string file)
     WebView* webView = setupTest(file, client);
 
     WebCore::TrackExceptionState es;
-    RefPtr<WebCore::Document> document = static_cast<PassRefPtr<WebCore::Document> >(webView->mainFrame()->document());
+    RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillBeRawPtr<WebCore::Document> >(webView->mainFrame()->document());
     RefPtr<WebCore::NodeList> hostNodes = document->querySelectorAll("[shadow-host]", es);
     ASSERT_FALSE(es.hadException());
     ASSERT_GE(hostNodes->length(), 1u);
@@ -173,7 +173,7 @@ WebView* TouchActionTest::setupTest(std::string file, TouchActionTrackingWebView
 
     // Scroll to verify the code properly transforms windows to client co-ords.
     const int kScrollOffset = 100;
-    RefPtr<WebCore::Document> document = static_cast<PassRefPtr<WebCore::Document> >(webView->mainFrame()->document());
+    RefPtrWillBeRawPtr<WebCore::Document> document = static_cast<PassRefPtrWillBeRawPtr<WebCore::Document> >(webView->mainFrame()->document());
     document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffset));
 
     return webView;
@@ -206,9 +206,9 @@ void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi
         // Note that we don't want the bounding box because our tests sometimes have elements with
         // multiple border boxes with other elements in between. Use the first border box (which
         // we can easily visualize in a browser for debugging).
-        RefPtr<WebCore::ClientRectList> rects = element->getClientRects();
+        RefPtrWillBeRawPtr<WebCore::ClientRectList> rects = element->getClientRects();
         ASSERT_GE(rects->length(), 0u) << failureContext;
-        RefPtr<WebCore::ClientRect> r = rects->item(0);
+        RefPtrWillBeRawPtr<WebCore::ClientRect> r = rects->item(0);
         WebCore::FloatRect clientFloatRect = WebCore::FloatRect(r->left(), r->top(), r->width(), r->height());
         WebCore::IntRect clientRect =  enclosedIntRect(clientFloatRect);
         for (int locIdx = 0; locIdx < 3; locIdx++) {
@@ -294,6 +294,8 @@ void TouchActionTest::sendTouchEvent(WebView* webView, WebInputEvent::Type type,
 
     WebTouchEvent webTouchEvent;
     webTouchEvent.type = type;
+    if (type == WebInputEvent::TouchCancel)
+        webTouchEvent.cancelable = false;
     webTouchEvent.touchesLength = 1;
     webTouchEvent.touches[0].state = (type == WebInputEvent::TouchStart ?
         WebTouchPoint::StatePressed :