Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: cc/CCLayerTreeHostTest.cpp

Issue 10920059: Rolls cc and webkit_compositor up to 127340 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCMathUtilTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "CCLayerTreeHost.h" 7 #include "CCLayerTreeHost.h"
8 8
9 #include "CCGeometryTestUtils.h"
9 #include "CCGraphicsContext.h" 10 #include "CCGraphicsContext.h"
10 #include "CCLayerTreeHostImpl.h" 11 #include "CCLayerTreeHostImpl.h"
11 #include "CCOcclusionTrackerTestCommon.h" 12 #include "CCOcclusionTrackerTestCommon.h"
12 #include "CCSettings.h" 13 #include "CCSettings.h"
13 #include "CCSingleThreadProxy.h" 14 #include "CCSingleThreadProxy.h"
14 #include "CCTextureUpdateQueue.h" 15 #include "CCTextureUpdateQueue.h"
15 #include "CCThreadedTest.h" 16 #include "CCThreadedTest.h"
16 #include "CCTimingFunction.h" 17 #include "CCTimingFunction.h"
17 #include "ContentLayerChromium.h" 18 #include "ContentLayerChromium.h"
18 #include "ContentLayerChromiumClient.h" 19 #include "ContentLayerChromiumClient.h"
19 #include "Extensions3DChromium.h" 20 #include "Extensions3DChromium.h"
20 #include "FakeWebCompositorOutputSurface.h" 21 #include "FakeWebCompositorOutputSurface.h"
21 #include <gmock/gmock.h> 22 #include <gmock/gmock.h>
22 #include <public/Platform.h> 23 #include <public/Platform.h>
23 #include <wtf/MainThread.h> 24 #include <wtf/MainThread.h>
24 #include <wtf/OwnArrayPtr.h> 25 #include <wtf/OwnArrayPtr.h>
25 26
26 using namespace WebCore; 27 using namespace WebCore;
27 using namespace WebKit; 28 using namespace WebKit;
28 using namespace WebKitTests; 29 using namespace WebKitTests;
29 30
30 #define EXPECT_EQ_RECT(a, b) \
31 EXPECT_EQ(a.x(), b.x()); \
32 EXPECT_EQ(a.y(), b.y()); \
33 EXPECT_EQ(a.width(), b.width()); \
34 EXPECT_EQ(a.height(), b.height());
35
36 namespace { 31 namespace {
37 32
38 class CCLayerTreeHostTest : public CCThreadedTest { }; 33 class CCLayerTreeHostTest : public CCThreadedTest { };
39 34
40 // Shortlived layerTreeHosts shouldn't die. 35 // Shortlived layerTreeHosts shouldn't die.
41 class CCLayerTreeHostTestShortlived1 : public CCLayerTreeHostTest { 36 class CCLayerTreeHostTestShortlived1 : public CCLayerTreeHostTest {
42 public: 37 public:
43 CCLayerTreeHostTestShortlived1() { } 38 CCLayerTreeHostTestShortlived1() { }
44 39
45 virtual void beginTest() OVERRIDE 40 virtual void beginTest() OVERRIDE
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 // Compute all the layer transforms for the frame. 1314 // Compute all the layer transforms for the frame.
1320 MockLayerTreeHostImpl::CCLayerList renderSurfaceLayerList; 1315 MockLayerTreeHostImpl::CCLayerList renderSurfaceLayerList;
1321 mockImpl->calculateRenderSurfaceLayerList(renderSurfaceLayerList); 1316 mockImpl->calculateRenderSurfaceLayerList(renderSurfaceLayerList);
1322 1317
1323 // Both layers should be drawing into the root render surface. 1318 // Both layers should be drawing into the root render surface.
1324 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 1319 ASSERT_EQ(1u, renderSurfaceLayerList.size());
1325 ASSERT_EQ(root->renderSurface(), renderSurfaceLayerList[0]->renderSurfac e()); 1320 ASSERT_EQ(root->renderSurface(), renderSurfaceLayerList[0]->renderSurfac e());
1326 ASSERT_EQ(2u, root->renderSurface()->layerList().size()); 1321 ASSERT_EQ(2u, root->renderSurface()->layerList().size());
1327 1322
1328 // The root render surface is the size of the viewport. 1323 // The root render surface is the size of the viewport.
1329 EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect ()); 1324 EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect ());
1330 1325
1331 WebTransformationMatrix scaleTransform; 1326 WebTransformationMatrix scaleTransform;
1332 scaleTransform.scale(impl->deviceScaleFactor()); 1327 scaleTransform.scale(impl->deviceScaleFactor());
1333 1328
1334 // The root layer is scaled by 2x. 1329 // The root layer is scaled by 2x.
1335 WebTransformationMatrix rootScreenSpaceTransform = scaleTransform; 1330 WebTransformationMatrix rootScreenSpaceTransform = scaleTransform;
1336 WebTransformationMatrix rootDrawTransform = scaleTransform; 1331 WebTransformationMatrix rootDrawTransform = scaleTransform;
1337 1332
1338 EXPECT_EQ(rootDrawTransform, root->drawTransform()); 1333 EXPECT_EQ(rootDrawTransform, root->drawTransform());
1339 EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform()); 1334 EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform());
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false); 1654 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
1660 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1655 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1661 1656
1662 m_layerTreeHost->setRootLayer(rootLayer); 1657 m_layerTreeHost->setRootLayer(rootLayer);
1663 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1658 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1664 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); 1659 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded());
1665 CCTextureUpdateQueue queue; 1660 CCTextureUpdateQueue queue;
1666 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1661 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1667 m_layerTreeHost->commitComplete(); 1662 m_layerTreeHost->commitComplete();
1668 1663
1669 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1664 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1670 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1665 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1671 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1666 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1672 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1667 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1673 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace ().bounds()); 1668 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace ().bounds());
1674 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1669 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1675 1670
1676 // If the child layer is opaque, then it adds to the occlusion seen by t he rootLayer. 1671 // If the child layer is opaque, then it adds to the occlusion seen by t he rootLayer.
1677 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1672 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1678 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1673 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1679 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1674 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1680 1675
1681 m_layerTreeHost->setRootLayer(rootLayer); 1676 m_layerTreeHost->setRootLayer(rootLayer);
1682 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1677 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1683 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1678 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1684 m_layerTreeHost->commitComplete(); 1679 m_layerTreeHost->commitComplete();
1685 1680
1686 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1681 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1687 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1682 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1688 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1683 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1689 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1684 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1690 EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace ().bounds()); 1685 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace ().bounds());
1691 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1686 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1692 1687
1693 // Add a second child to the root layer and the regions should merge 1688 // Add a second child to the root layer and the regions should merge
1694 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1689 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1695 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true); 1690 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
1696 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1691 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1697 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1692 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1698 1693
1699 m_layerTreeHost->setRootLayer(rootLayer); 1694 m_layerTreeHost->setRootLayer(rootLayer);
1700 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1695 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1701 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1696 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1702 m_layerTreeHost->commitComplete(); 1697 m_layerTreeHost->commitComplete();
1703 1698
1704 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1699 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1705 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1700 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1706 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1701 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1707 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1702 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1708 EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace(). bounds()); 1703 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace(). bounds());
1709 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); 1704 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
1710 EXPECT_EQ_RECT(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace ().bounds()); 1705 EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace ().bounds());
1711 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); 1706 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
1712 1707
1713 // Move the second child to be sure. 1708 // Move the second child to be sure.
1714 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1709 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1715 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1710 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1716 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1711 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1717 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1712 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1718 1713
1719 m_layerTreeHost->setRootLayer(rootLayer); 1714 m_layerTreeHost->setRootLayer(rootLayer);
1720 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1715 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1721 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1716 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1722 m_layerTreeHost->commitComplete(); 1717 m_layerTreeHost->commitComplete();
1723 1718
1724 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1719 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1725 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1720 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1726 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1721 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1727 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1722 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1728 EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace(). bounds()); 1723 EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace(). bounds());
1729 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); 1724 EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
1730 EXPECT_EQ_RECT(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace ().bounds()); 1725 EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace ().bounds());
1731 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); 1726 EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
1732 1727
1733 // If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it 1728 // If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it
1734 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1729 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1735 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1730 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1736 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1731 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1737 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1732 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1738 1733
1739 child->setMaskLayer(mask.get()); 1734 child->setMaskLayer(mask.get());
1740 1735
1741 m_layerTreeHost->setRootLayer(rootLayer); 1736 m_layerTreeHost->setRootLayer(rootLayer);
1742 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1737 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1743 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1738 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1744 m_layerTreeHost->commitComplete(); 1739 m_layerTreeHost->commitComplete();
1745 1740
1746 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1741 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1747 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1742 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1748 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1743 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1749 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1744 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1750 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1745 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1751 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1746 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1752 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1747 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1753 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1748 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1754 1749
1755 // If the child layer with a mask is below child2, then child2 should co ntribute to occlusion on everything, and child shouldn't contribute to the rootL ayer 1750 // If the child layer with a mask is below child2, then child2 should co ntribute to occlusion on everything, and child shouldn't contribute to the rootL ayer
1756 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1751 setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPo int(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1757 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1752 setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransfor m, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1758 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1753 setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1759 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1754 setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatr ix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1760 1755
1761 child->setMaskLayer(mask.get()); 1756 child->setMaskLayer(mask.get());
1762 1757
1763 m_layerTreeHost->setRootLayer(rootLayer); 1758 m_layerTreeHost->setRootLayer(rootLayer);
1764 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1759 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1765 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1760 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1766 m_layerTreeHost->commitComplete(); 1761 m_layerTreeHost->commitComplete();
1767 1762
1768 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1763 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1769 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1764 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1770 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds()); 1765 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds());
1771 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); 1766 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
1772 EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds()); 1767 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds());
1773 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); 1768 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
1774 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1769 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1775 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1770 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1776 1771
1777 // If the child layer has a non-opaque drawOpacity, then it shouldn't co ntribute to occlusion on stuff below it 1772 // If the child layer has a non-opaque drawOpacity, then it shouldn't co ntribute to occlusion on stuff below it
1778 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1773 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1779 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1774 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1780 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1775 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1781 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1776 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1782 1777
1783 child->setMaskLayer(0); 1778 child->setMaskLayer(0);
1784 child->setOpacity(0.5); 1779 child->setOpacity(0.5);
1785 1780
1786 m_layerTreeHost->setRootLayer(rootLayer); 1781 m_layerTreeHost->setRootLayer(rootLayer);
1787 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1782 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1788 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1783 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1789 m_layerTreeHost->commitComplete(); 1784 m_layerTreeHost->commitComplete();
1790 1785
1791 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1786 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1792 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1787 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1793 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1788 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1794 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1789 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1795 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1790 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1796 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1791 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1797 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1792 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1798 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1793 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1799 1794
1800 // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contrib ute to the rootLayer 1795 // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contrib ute to the rootLayer
1801 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1796 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1802 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1797 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1803 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1798 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1804 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1799 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1805 1800
1806 child->setMaskLayer(0); 1801 child->setMaskLayer(0);
1807 child->setOpacity(0.5); 1802 child->setOpacity(0.5);
1808 1803
1809 m_layerTreeHost->setRootLayer(rootLayer); 1804 m_layerTreeHost->setRootLayer(rootLayer);
1810 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1805 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1811 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1806 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1812 m_layerTreeHost->commitComplete(); 1807 m_layerTreeHost->commitComplete();
1813 1808
1814 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1809 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1815 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1810 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1816 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds()); 1811 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds());
1817 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); 1812 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
1818 EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds()); 1813 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds());
1819 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); 1814 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
1820 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1815 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1821 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1816 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1822 1817
1823 // Kill the layerTreeHost immediately. 1818 // Kill the layerTreeHost immediately.
1824 m_layerTreeHost->setRootLayer(0); 1819 m_layerTreeHost->setRootLayer(0);
1825 m_layerTreeHost.clear(); 1820 m_layerTreeHost.clear();
1826 1821
1827 endTest(); 1822 endTest();
1828 } 1823 }
1829 1824
1830 virtual void afterTest() OVERRIDE 1825 virtual void afterTest() OVERRIDE
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 child->setFilters(filters); 1862 child->setFilters(filters);
1868 } 1863 }
1869 1864
1870 m_layerTreeHost->setRootLayer(rootLayer); 1865 m_layerTreeHost->setRootLayer(rootLayer);
1871 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1866 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1872 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); 1867 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded());
1873 CCTextureUpdateQueue queue; 1868 CCTextureUpdateQueue queue;
1874 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1869 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1875 m_layerTreeHost->commitComplete(); 1870 m_layerTreeHost->commitComplete();
1876 1871
1877 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1872 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1878 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1873 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1879 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds()); 1874 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpac e().bounds());
1880 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); 1875 EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
1881 EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds()); 1876 EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().b ounds());
1882 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); 1877 EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
1883 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1878 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1884 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1879 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1885 1880
1886 // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtre e, 1881 // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtre e,
1887 // and should not contribute to the rootLayer 1882 // and should not contribute to the rootLayer
1888 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true); 1883 setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, Flo atPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
1889 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true); 1884 setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTran sform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
1890 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true); 1885 setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
1891 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true); 1886 setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identity Matrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
1892 1887
1893 { 1888 {
1894 WebFilterOperations filters; 1889 WebFilterOperations filters;
1895 filters.append(WebFilterOperation::createBlurFilter(10)); 1890 filters.append(WebFilterOperation::createBlurFilter(10));
1896 child->setFilters(filters); 1891 child->setFilters(filters);
1897 } 1892 }
1898 1893
1899 m_layerTreeHost->setRootLayer(rootLayer); 1894 m_layerTreeHost->setRootLayer(rootLayer);
1900 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1895 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1901 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1896 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1902 m_layerTreeHost->commitComplete(); 1897 m_layerTreeHost->commitComplete();
1903 1898
1904 EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); 1899 EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
1905 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1900 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1906 EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); 1901 EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
1907 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1902 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1908 EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds()); 1903 EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().b ounds());
1909 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1904 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1910 EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds()); 1905 EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace ().bounds());
1911 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1906 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1912 1907
1913 // Kill the layerTreeHost immediately. 1908 // Kill the layerTreeHost immediately.
1914 m_layerTreeHost->setRootLayer(0); 1909 m_layerTreeHost->setRootLayer(0);
1915 m_layerTreeHost.clear(); 1910 m_layerTreeHost.clear();
1916 1911
1917 CCLayerTreeHost::setNeedsFilterContext(false); 1912 CCLayerTreeHost::setNeedsFilterContext(false);
1918 endTest(); 1913 endTest();
1919 } 1914 }
1920 1915
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 m_layerTreeHost->setRootLayer(layers[0].get()); 1954 m_layerTreeHost->setRootLayer(layers[0].get());
1960 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds( )); 1955 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds( ));
1961 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); 1956 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded());
1962 CCTextureUpdateQueue queue; 1957 CCTextureUpdateQueue queue;
1963 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1958 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1964 m_layerTreeHost->commitComplete(); 1959 m_layerTreeHost->commitComplete();
1965 1960
1966 for (int i = 0; i < numSurfaces-1; ++i) { 1961 for (int i = 0; i < numSurfaces-1; ++i) {
1967 IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); 1962 IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
1968 1963
1969 EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().b ounds()); 1964 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b ounds());
1970 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); 1965 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
1971 } 1966 }
1972 1967
1973 // Kill the layerTreeHost immediately. 1968 // Kill the layerTreeHost immediately.
1974 m_layerTreeHost->setRootLayer(0); 1969 m_layerTreeHost->setRootLayer(0);
1975 m_layerTreeHost.clear(); 1970 m_layerTreeHost.clear();
1976 1971
1977 endTest(); 1972 endTest();
1978 } 1973 }
1979 1974
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 int m_numChildren; 2806 int m_numChildren;
2812 Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children; 2807 Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
2813 }; 2808 };
2814 2809
2815 TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread) 2810 TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread)
2816 { 2811 {
2817 runTest(true); 2812 runTest(true);
2818 } 2813 }
2819 2814
2820 } // namespace 2815 } // namespace
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImplTest.cpp ('k') | cc/CCMathUtilTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698