[chromium] Add WebUnitTestSupport::createLayerTreeViewForTesting for webkit_unit_tests
[WebKit-https.git] / Source / WebKit / chromium / tests / ScrollingCoordinatorChromiumTest.cpp
index 55b0b39..2667cb5 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CompositorFakeWebGraphicsContext3D.h"
 #include "FrameTestHelpers.h"
+#include "GraphicsLayerChromium.h"
 #include "RenderLayerBacking.h"
 #include "RenderLayerCompositor.h"
 #include "RenderView.h"
 #include "WebViewClient.h"
 #include "WebViewImpl.h"
 #include <gtest/gtest.h>
+#include <public/Platform.h>
 #include <public/WebCompositorSupport.h>
 #include <public/WebLayer.h>
-#include <webkit/support/webkit_support.h>
-
-#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
-#include "GraphicsLayerChromium.h"
-#endif
+#include <public/WebUnitTestSupport.h>
 
 using namespace WebCore;
 using namespace WebKit;
@@ -61,8 +59,9 @@ public:
 
     virtual void initializeLayerTreeView(WebLayerTreeViewClient* client, const WebLayer& rootLayer, const WebLayerTreeView::Settings& settings)
     {
-        m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(client, rootLayer, settings));
+        m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
         ASSERT(m_layerTreeView);
+        m_layerTreeView->setRootLayer(rootLayer);
     }
 
     virtual WebLayerTreeView* layerTreeView()
@@ -91,6 +90,7 @@ public:
         m_webViewImpl->settings()->setForceCompositingMode(true);
         m_webViewImpl->settings()->setAcceleratedCompositingEnabled(true);
         m_webViewImpl->settings()->setAcceleratedCompositingForFixedPositionEnabled(true);
+        m_webViewImpl->settings()->setAcceleratedCompositingForOverflowScrollEnabled(true);
         m_webViewImpl->settings()->setFixedPositionCreatesStackingContext(true);
         m_webViewImpl->initializeMainFrame(&m_mockWebFrameClient);
         m_webViewImpl->resize(IntSize(320, 240));
@@ -98,7 +98,7 @@ public:
 
     virtual ~ScrollingCoordinatorChromiumTest()
     {
-        webkit_support::UnregisterAllMockedURLs();
+        Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
         m_webViewImpl->close();
 
         Platform::current()->compositorSupport()->shutdown();
@@ -107,7 +107,7 @@ public:
     void navigateTo(const std::string& url)
     {
         FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url);
-        webkit_support::ServeAsynchronousMockedRequests();
+        Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
     }
 
     void registerMockedHttpURLLoad(const std::string& fileName)
@@ -208,11 +208,10 @@ TEST_F(ScrollingCoordinatorChromiumTest, clippedBodyTest)
     ASSERT_EQ(0u, rootScrollLayer->nonFastScrollableRegion().size());
 }
 
-#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
-TEST_F(ScrollingCoordinatorChromiumTest, touchOverflowScrolling)
+TEST_F(ScrollingCoordinatorChromiumTest, overflowScrolling)
 {
-    registerMockedHttpURLLoad("touch-overflow-scrolling.html");
-    navigateTo(m_baseURL + "touch-overflow-scrolling.html");
+    registerMockedHttpURLLoad("overflow-scrolling.html");
+    navigateTo(m_baseURL + "overflow-scrolling.html");
 
     // Verify the properties of the accelerated scrolling element starting from the RenderObject
     // all the way to the WebLayer.
@@ -237,6 +236,5 @@ TEST_F(ScrollingCoordinatorChromiumTest, touchOverflowScrolling)
     WebLayer* webScrollLayer = static_cast<WebLayer*>(layerBacking->scrollingContentsLayer()->platformLayer());
     ASSERT_TRUE(webScrollLayer->scrollable());
 }
-#endif // ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
 
 } // namespace