diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 02:18:51 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-02 02:18:51 +0000 |
commit | a91cd2adcf566b47fabe89702f9b3c0972242a5f (patch) | |
tree | 9702e2a72e3aa5aa32e1d477eebb926af545178b /webkit | |
parent | 6e44890c4524e61517c84bf408524b27f1d58a77 (diff) | |
download | chromium_src-a91cd2adcf566b47fabe89702f9b3c0972242a5f.zip chromium_src-a91cd2adcf566b47fabe89702f9b3c0972242a5f.tar.gz chromium_src-a91cd2adcf566b47fabe89702f9b3c0972242a5f.tar.bz2 |
Get rid of WebLayerTreeViewClient references in WebLayerTreeViewImplForTesting
Follow-up to r185341 / WebKit r144398
The only client this class needs is the DRTLayerTreeViewClient.
Review URL: https://codereview.chromium.org/12377029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
8 files changed, 5 insertions, 278 deletions
diff --git a/webkit/compositor_bindings/compositor_bindings_tests.gyp b/webkit/compositor_bindings/compositor_bindings_tests.gyp index 19a4914..2107963 100644 --- a/webkit/compositor_bindings/compositor_bindings_tests.gyp +++ b/webkit/compositor_bindings/compositor_bindings_tests.gyp @@ -9,10 +9,8 @@ 'web_animation_unittest.cc', 'web_float_animation_curve_unittest.cc', 'web_layer_impl_fixed_bounds_unittest.cc', - 'web_layer_unittest.cc', 'web_transform_animation_curve_unittest.cc', 'web_transformation_matrix_unittest.cc', - 'test/web_layer_tree_view_test_common.h', ], }, 'targets': [ diff --git a/webkit/compositor_bindings/test/web_layer_tree_view_test_common.h b/webkit/compositor_bindings/test/web_layer_tree_view_test_common.h deleted file mode 100644 index b600d38..0000000 --- a/webkit/compositor_bindings/test/web_layer_tree_view_test_common.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WebLayerTreeViewTestCommon_h -#define WebLayerTreeViewTestCommon_h - -#include "cc/test/fake_output_surface.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h" - -namespace WebKit { - -class MockWebLayerTreeViewClient : public WebLayerTreeViewClient { - public: - MOCK_METHOD0(scheduleComposite, void()); - MOCK_METHOD0(willBeginFrame, void()); - MOCK_METHOD0(didBeginFrame, void()); - virtual void updateAnimations(double frame_begin_time) {} - virtual void layout() {} - virtual void applyScrollAndScale(const WebSize& scroll_delta, - float scale_factor) {} - - virtual cc::OutputSurface* createOutputSurface() { - return cc::createFakeOutputSurface().release(); - } - virtual void didRecreateOutputSurface(bool) {} - - MOCK_METHOD0(willCommit, void()); - MOCK_METHOD0(didCommit, void()); - virtual void didCommitAndDrawFrame() {} - virtual void didCompleteSwapBuffers() {} -}; - -} - -#endif // WebLayerTreeViewTestCommon_h diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc index 3479acf..aee2821 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc +++ b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc @@ -21,7 +21,6 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandler.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRenderingStats.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" #include "webkit/compositor_bindings/web_compositor_support_impl.h" @@ -37,14 +36,6 @@ WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( RenderingType type, webkit_support::DRTLayerTreeViewClient* client) : type_(type), - drt_client_(client), - client_(NULL) {} - -WebLayerTreeViewImplForTesting::WebLayerTreeViewImplForTesting( - RenderingType type, - WebKit::WebLayerTreeViewClient* client) - : type_(type), - drt_client_(NULL), client_(client) {} WebLayerTreeViewImplForTesting::~WebLayerTreeViewImplForTesting() {} @@ -174,10 +165,8 @@ void WebLayerTreeViewImplForTesting::animate( } void WebLayerTreeViewImplForTesting::layout() { - if (drt_client_) - drt_client_->Layout(); if (client_) - client_->layout(); + client_->Layout(); } void WebLayerTreeViewImplForTesting::applyScrollAndScale( @@ -229,10 +218,8 @@ void WebLayerTreeViewImplForTesting::didCommitAndDrawFrame() {} void WebLayerTreeViewImplForTesting::didCompleteSwapBuffers() {} void WebLayerTreeViewImplForTesting::scheduleComposite() { - if (drt_client_) - drt_client_->ScheduleComposite(); if (client_) - client_->scheduleComposite(); + client_->ScheduleComposite(); } scoped_refptr<cc::ContextProvider> diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h index 69ed117..8b9c24c 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h +++ b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h @@ -18,8 +18,6 @@ class Thread; namespace WebKit { class WebLayer; -class WebLayerTreeViewClient; -class WebLayerTreeViewClientAdapter; class WebLayerTreeViewImplForTesting : public WebKit::WebLayerTreeView, public cc::LayerTreeHostClient { @@ -32,9 +30,6 @@ class WebLayerTreeViewImplForTesting : public WebKit::WebLayerTreeView, WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerTreeViewImplForTesting( RenderingType type, webkit_support::DRTLayerTreeViewClient* client); - WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerTreeViewImplForTesting( - RenderingType type, - WebKit::WebLayerTreeViewClient* client); virtual ~WebLayerTreeViewImplForTesting(); WEBKIT_COMPOSITOR_BINDINGS_EXPORT bool initialize( @@ -93,8 +88,7 @@ class WebLayerTreeViewImplForTesting : public WebKit::WebLayerTreeView, private: RenderingType type_; - webkit_support::DRTLayerTreeViewClient* drt_client_; - WebKit::WebLayerTreeViewClient* client_; + webkit_support::DRTLayerTreeViewClient* client_; scoped_ptr<cc::LayerTreeHost> layer_tree_host_; }; diff --git a/webkit/compositor_bindings/web_layer_unittest.cc b/webkit/compositor_bindings/web_layer_unittest.cc deleted file mode 100644 index b2f5caa..0000000 --- a/webkit/compositor_bindings/web_layer_unittest.cc +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/thread.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayerClient.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureLayer.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerScrollClient.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" -#include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.h" -#include "webkit/compositor_bindings/test/web_layer_tree_view_test_common.h" -#include "webkit/compositor_bindings/web_content_layer_impl.h" -#include "webkit/compositor_bindings/web_external_texture_layer_impl.h" -#include "webkit/compositor_bindings/web_layer_impl.h" -#include "webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.h" -#include "webkit/compositor_bindings/web_solid_color_layer_impl.h" - -using namespace WebKit; -using testing::AnyNumber; -using testing::AtLeast; -using testing::Mock; -using testing::Test; -using testing::_; - -namespace { - -class MockWebContentLayerClient : public WebContentLayerClient { - public: - MOCK_METHOD4(paintContents, - void(WebCanvas*, - const WebRect& clip, - bool can_paint_lcd_text, - WebFloatRect& opaque)); -}; - -class WebLayerTest : public Test { - public: - WebLayerTest() {} - - virtual void SetUp() { - root_layer_.reset(new WebLayerImpl); - EXPECT_CALL(client_, scheduleComposite()).Times(AnyNumber()); - view_.reset(new WebLayerTreeViewImplForTesting( - WebLayerTreeViewImplForTesting::FAKE_CONTEXT, &client_)); - EXPECT_TRUE(view_->initialize(scoped_ptr<cc::Thread>(NULL))); - view_->setRootLayer(*root_layer_); - EXPECT_TRUE(view_); - Mock::VerifyAndClearExpectations(&client_); - } - - virtual void TearDown() { - // We may get any number of scheduleComposite calls during shutdown. - EXPECT_CALL(client_, scheduleComposite()).Times(AnyNumber()); - root_layer_.reset(); - view_.reset(); - } - - protected: - MockWebLayerTreeViewClient client_; - scoped_ptr<WebLayer> root_layer_; - scoped_ptr<WebLayerTreeViewImplForTesting> view_; -}; - -// Tests that the client gets called to ask for a composite if we change the -// fields. -TEST_F(WebLayerTest, Client) { - // Base layer. - EXPECT_CALL(client_, scheduleComposite()).Times(AnyNumber()); - scoped_ptr<WebLayer> layer(new WebLayerImpl); - layer->setDrawsContent(true); - root_layer_->addChild(layer.get()); - Mock::VerifyAndClearExpectations(&client_); - - WebFloatPoint point(3, 4); - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - layer->setAnchorPoint(point); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_EQ(point, layer->anchorPoint()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - float anchorZ = 5; - layer->setAnchorPointZ(anchorZ); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_EQ(anchorZ, layer->anchorPointZ()); - - WebSize size(7, 8); - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - layer->setBounds(size); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_EQ(size, layer->bounds()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - layer->setMasksToBounds(true); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_TRUE(layer->masksToBounds()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AnyNumber()); - scoped_ptr<WebLayer> other_layer_1(new WebLayerImpl); - root_layer_->addChild(other_layer_1.get()); - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - scoped_ptr<WebLayer> other_layer_2(new WebLayerImpl); - layer->setMaskLayer(other_layer_2.get()); - Mock::VerifyAndClearExpectations(&client_); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - float opacity = 0.123f; - layer->setOpacity(opacity); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_EQ(opacity, layer->opacity()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - layer->setOpaque(true); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_TRUE(layer->opaque()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - layer->setPosition(point); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_EQ(point, layer->position()); - - // Texture layer. - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - scoped_ptr<WebExternalTextureLayer> texture_layer( - new WebExternalTextureLayerImpl(NULL)); - root_layer_->addChild(texture_layer->layer()); - Mock::VerifyAndClearExpectations(&client_); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - texture_layer->setTextureId(3); - Mock::VerifyAndClearExpectations(&client_); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - texture_layer->setFlipped(true); - Mock::VerifyAndClearExpectations(&client_); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - WebFloatRect uv_rect(0.1f, 0.1f, 0.9f, 0.9f); - texture_layer->setUVRect(uv_rect); - Mock::VerifyAndClearExpectations(&client_); - - // Content layer. - MockWebContentLayerClient content_client; - EXPECT_CALL(content_client, paintContents(_, _, _, _)).Times(AnyNumber()); - - EXPECT_CALL(client_, scheduleComposite()).Times(AnyNumber()); - scoped_ptr<WebContentLayer> content_layer( - new WebContentLayerImpl(&content_client)); - root_layer_->addChild(content_layer->layer()); - Mock::VerifyAndClearExpectations(&client_); - - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - content_layer->layer()->setDrawsContent(false); - Mock::VerifyAndClearExpectations(&client_); - EXPECT_FALSE(content_layer->layer()->drawsContent()); - - // Solid color layer. - EXPECT_CALL(client_, scheduleComposite()).Times(AtLeast(1)); - scoped_ptr<WebSolidColorLayer> solid_color_layer(new WebSolidColorLayerImpl); - root_layer_->addChild(solid_color_layer->layer()); - Mock::VerifyAndClearExpectations(&client_); - -} - -class MockScrollClient : public WebLayerScrollClient { - public: - MOCK_METHOD0(didScroll, void()); -}; - -TEST_F(WebLayerTest, notify_scroll_client) { - MockScrollClient scroll_client; - - EXPECT_CALL(scroll_client, didScroll()).Times(0); - root_layer_->setScrollClient(&scroll_client); - Mock::VerifyAndClearExpectations(&scroll_client); - - EXPECT_CALL(scroll_client, didScroll()).Times(1); - root_layer_->setScrollPosition(WebPoint(14, 19)); - Mock::VerifyAndClearExpectations(&scroll_client); - - EXPECT_CALL(scroll_client, didScroll()).Times(0); - root_layer_->setScrollPosition(WebPoint(14, 19)); - Mock::VerifyAndClearExpectations(&scroll_client); - - root_layer_->setScrollClient(0); -} - -} diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 54b8358..b1254a7 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -568,8 +568,7 @@ WebKit::WebLayerTreeView* TestWebKitPlatformSupport::createLayerTreeViewForTesting() { scoped_ptr<WebLayerTreeViewImplForTesting> view( new WebLayerTreeViewImplForTesting( - WebLayerTreeViewImplForTesting::FAKE_CONTEXT, - static_cast<WebKit::WebLayerTreeViewClient*>(NULL))); + WebLayerTreeViewImplForTesting::FAKE_CONTEXT, NULL)); if (!view->initialize(scoped_ptr<cc::Thread>())) return NULL; diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index ef455d0..da6b4e6 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -523,10 +523,9 @@ WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( return NULL; } -template <typename Client> static WebKit::WebLayerTreeView* CreateLayerTreeView( WebKit::WebLayerTreeViewImplForTesting::RenderingType type, - Client* client) { + DRTLayerTreeViewClient* client) { scoped_ptr<WebKit::WebLayerTreeViewImplForTesting> view( new WebKit::WebLayerTreeViewImplForTesting(type, client)); @@ -544,18 +543,6 @@ static WebKit::WebLayerTreeView* CreateLayerTreeView( } WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( - WebKit::WebLayerTreeViewClient* client) { - return CreateLayerTreeView( - WebKit::WebLayerTreeViewImplForTesting::SOFTWARE_CONTEXT, client); -} - -WebKit::WebLayerTreeView* CreateLayerTreeView3d( - WebKit::WebLayerTreeViewClient* client) { - return CreateLayerTreeView( - WebKit::WebLayerTreeViewImplForTesting::MESA_CONTEXT, client); -} - -WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( DRTLayerTreeViewClient* client) { return CreateLayerTreeView( WebKit::WebLayerTreeViewImplForTesting::SOFTWARE_CONTEXT, client); diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 03b1031..d8997905 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -29,7 +29,6 @@ class WebFileSystemCallbacks; class WebFrame; class WebGamepads; class WebLayerTreeView; -class WebLayerTreeViewClient; class WebMediaPlayer; class WebMediaPlayerClient; class WebPlugin; @@ -142,11 +141,6 @@ class DRTLayerTreeViewClient { }; WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( - WebKit::WebLayerTreeViewClient* client); -WebKit::WebLayerTreeView* CreateLayerTreeView3d( - WebKit::WebLayerTreeViewClient* client); - -WebKit::WebLayerTreeView* CreateLayerTreeViewSoftware( DRTLayerTreeViewClient* client); WebKit::WebLayerTreeView* CreateLayerTreeView3d( DRTLayerTreeViewClient* client); |