Skip to content
Permalink
Browse files
[chromium] Unit test for bug #77996
https://bugs.webkit.org/show_bug.cgi?id=78019

Patch by Dana Jansens <danakj@chromium.org> on 2012-02-07
Reviewed by James Robinson.

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestManySurfaces):
(WTF::CCLayerTreeHostTestManySurfaces::CCLayerTreeHostTestManySurfaces):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::afterTest):
(WTF):

Canonical link: https://commits.webkit.org/94910@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
danakj authored and webkit-commit-queue committed Feb 7, 2012
1 parent 09882a1 commit 632dd01e6c1d9b6467368c8d6b58755914b229bd
Showing 2 changed files with 71 additions and 0 deletions.
@@ -1,3 +1,17 @@
2012-02-07 Dana Jansens <danakj@chromium.org>

[chromium] Unit test for bug #77996
https://bugs.webkit.org/show_bug.cgi?id=78019

Reviewed by James Robinson.

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestManySurfaces):
(WTF::CCLayerTreeHostTestManySurfaces::CCLayerTreeHostTestManySurfaces):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::afterTest):
(WTF):

2012-02-07 Sadrul Habib Chowdhury <sadrul@chromium.org>

Process Scroll-gesture events from the compositor.
@@ -1472,4 +1472,61 @@ class CCLayerTreeHostTestLayerOcclusion : public CCLayerTreeHostTest {

SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion)

class CCLayerTreeHostTestManySurfaces : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestManySurfaces() { }

virtual void beginTest()
{
// We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion.
Region occluded;
const TransformationMatrix identityMatrix;
Vector<RefPtr<TestLayerChromium> > layers;
Vector<RefPtr<TestLayerChromium> > children;
int numSurfaces = 20;
RefPtr<TestLayerChromium> replica = TestLayerChromium::create();

for (int i = 0; i < numSurfaces; ++i) {
layers.append(TestLayerChromium::create());
if (!i) {
setLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
layers.last()->createRenderSurface();
} else {
setLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(100-i, 100-i), true);
layers.last()->setMasksToBounds(true);
layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface
}
}

for (int i = 1; i < numSurfaces; ++i) {
children.append(TestLayerChromium::create());
setLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
}

m_layerTreeHost->setRootLayer(layers[0].get());
m_layerTreeHost->setViewportSize(layers[0]->bounds());
m_layerTreeHost->updateLayers();
m_layerTreeHost->commitComplete();

for (int i = 0; i < numSurfaces-1; ++i) {
IntRect expectedOcclusion(i+1, i+1, 100-i-1, 100-i-1);

EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().bounds());
EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
}

// Kill the layerTreeHost immediately.
m_layerTreeHost->setRootLayer(0);
m_layerTreeHost.clear();

endTest();
}

virtual void afterTest()
{
}
};

SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces)

} // namespace

0 comments on commit 632dd01

Please sign in to comment.