[chromium] Add WebUnitTestSupport::createLayerTreeViewForTesting for webkit_unit_tests
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 02:50:58 +0000 (02:50 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 02:50:58 +0000 (02:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109403

Reviewed by Adam Barth.

Source/Platform:

webkit_unit_tests that need compositing support need only a simple WebLayerTreeView implementation, not the full
thing.

* chromium/public/WebCompositorSupport.h:
(WebCompositorSupport):
(WebKit::WebCompositorSupport::createLayerTreeView):
* chromium/public/WebUnitTestSupport.h:
(WebKit):
(WebUnitTestSupport):
(WebKit::WebUnitTestSupport::createLayerTreeViewForTesting):

Source/WebKit/chromium:

* tests/GraphicsLayerChromiumTest.cpp:
(WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
* tests/ScrollingCoordinatorChromiumTest.cpp:
(WebKit::FakeWebViewClient::initializeLayerTreeView):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142568 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/Platform/ChangeLog
Source/Platform/chromium/public/WebCompositorSupport.h
Source/Platform/chromium/public/WebUnitTestSupport.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp
Source/WebKit/chromium/tests/ScrollingCoordinatorChromiumTest.cpp

index 87856e2..8c58ca5 100644 (file)
@@ -1,3 +1,21 @@
+2013-02-11  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Add WebUnitTestSupport::createLayerTreeViewForTesting for webkit_unit_tests
+        https://bugs.webkit.org/show_bug.cgi?id=109403
+
+        Reviewed by Adam Barth.
+
+        webkit_unit_tests that need compositing support need only a simple WebLayerTreeView implementation, not the full
+        thing.
+
+        * chromium/public/WebCompositorSupport.h:
+        (WebCompositorSupport):
+        (WebKit::WebCompositorSupport::createLayerTreeView):
+        * chromium/public/WebUnitTestSupport.h:
+        (WebKit):
+        (WebUnitTestSupport):
+        (WebKit::WebUnitTestSupport::createLayerTreeViewForTesting):
+
 2013-02-10  Florin Malita  <fmalita@chromium.org>
 
         [Chromium] FilterTypeSaturatingBrightness enum
index 5c7f733..fecc491 100644 (file)
@@ -69,9 +69,6 @@ public:
     // after shutdown.
     virtual void shutdown() { }
 
-    // May return 0 if initialization fails.
-    virtual WebLayerTreeView* createLayerTreeView(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&) { return 0; }
-
     // Creates an output surface for the compositor backed by a 3d context.
     virtual WebCompositorOutputSurface* createOutputSurfaceFor3D(WebKit::WebGraphicsContext3D*) { return 0; }
 
@@ -107,6 +104,13 @@ public:
 
     virtual WebTransformOperations* createTransformOperations() { return 0; }
 
+
+    // Testing ------------------------------------------------------
+
+    // DEPRECATED
+    // May return 0 if initialization fails.
+    virtual WebLayerTreeView* createLayerTreeView(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&) { return 0; }
+
 protected:
     virtual ~WebCompositorSupport() { }
 };
index 9a9e3ec..bb00bda 100644 (file)
@@ -31,6 +31,7 @@
 
 namespace WebKit {
 
+class WebLayerTreeView;
 class WebURL;
 class WebURLResponse;
 struct WebURLError;
@@ -52,6 +53,18 @@ public:
 
     // Returns the root directory of the WebKit code.
     virtual WebString webKitRootDir() { return WebString(); }
+
+    // Constructs a WebLayerTreeView set up with reasonable defaults for
+    // testing. A LayerTreeTypeUnitTest view can initialize and perform most
+    // operations, but is not capable of rendering pixels. A
+    // LayerTreeTypeLayoutTest view can render.
+
+#define HAVE_CREATELAYERTREEVIEWFORTESTING 1
+    enum TestViewType {
+        TestViewTypeUnitTest,
+        TestViewTypeLayoutTest
+    };
+    virtual WebLayerTreeView* createLayerTreeViewForTesting(TestViewType type) { return 0; }
 };
 
 }
index d95e798..3de6f35 100644 (file)
@@ -1,3 +1,15 @@
+2013-02-11  James Robinson  <jamesr@chromium.org>
+
+        [chromium] Add WebUnitTestSupport::createLayerTreeViewForTesting for webkit_unit_tests
+        https://bugs.webkit.org/show_bug.cgi?id=109403
+
+        Reviewed by Adam Barth.
+
+        * tests/GraphicsLayerChromiumTest.cpp:
+        (WebKit::GraphicsLayerChromiumTest::GraphicsLayerChromiumTest):
+        * tests/ScrollingCoordinatorChromiumTest.cpp:
+        (WebKit::FakeWebViewClient::initializeLayerTreeView):
+
 2013-02-11  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled Chromium DEPS to r181817.  Requested by
index 44af5f5..b16e72d 100644 (file)
 #include "WebLayerTreeViewTestCommon.h"
 #include <gtest/gtest.h>
 #include <public/Platform.h>
-#include <public/WebCompositorSupport.h>
 #include <public/WebFloatAnimationCurve.h>
 #include <public/WebGraphicsContext3D.h>
 #include <public/WebLayerTreeView.h>
 #include <public/WebTransformationMatrix.h>
+#include <public/WebUnitTestSupport.h>
 #include <wtf/PassOwnPtr.h>
 
 using namespace WebCore;
@@ -62,7 +62,9 @@ public:
         Platform::current()->compositorSupport()->initialize(0);
         m_graphicsLayer = adoptPtr(new GraphicsLayerChromium(&m_client));
         m_platformLayer = m_graphicsLayer->platformLayer();
-        m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(&m_layerTreeViewClient, *m_platformLayer, WebLayerTreeView::Settings()));
+        m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLayerTreeViewForTesting(WebUnitTestSupport::TestViewTypeUnitTest));
+        ASSERT_TRUE(m_layerTreeView);
+        m_layerTreeView->setRootLayer(*m_platformLayer);
         m_layerTreeView->setViewportSize(WebSize(1, 1), WebSize(1, 1));
     }
 
index bc6914f..2667cb5 100644 (file)
@@ -59,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()