diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 21:22:42 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-19 21:22:42 +0000 |
commit | c753e25a8b4366c44134a8c21b9ed3392bf48608 (patch) | |
tree | f378c8a762caccf60856a1670ae33dfd638b9453 /cc/damage_tracker_unittest.cc | |
parent | 503160f80568f024fa712e280bb1a4e1e6ca1ec3 (diff) | |
download | chromium_src-c753e25a8b4366c44134a8c21b9ed3392bf48608.zip chromium_src-c753e25a8b4366c44134a8c21b9ed3392bf48608.tar.gz chromium_src-c753e25a8b4366c44134a8c21b9ed3392bf48608.tar.bz2 |
Revert "cc: Rename cc classes and members to match filenames"
This reverts commit 184fac5add06d5f4670fa6be4a4d3b39232d51bb.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/damage_tracker_unittest.cc')
-rw-r--r-- | cc/damage_tracker_unittest.cc | 244 |
1 files changed, 122 insertions, 122 deletions
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc index eb7150a..b266558 100644 --- a/cc/damage_tracker_unittest.cc +++ b/cc/damage_tracker_unittest.cc @@ -22,9 +22,9 @@ using namespace WebKitTests; namespace { -void executeCalculateDrawTransformsAndVisibility(LayerImpl* root, std::vector<LayerImpl*>& renderSurfaceLayerList) +void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* root, std::vector<CCLayerImpl*>& renderSurfaceLayerList) { - LayerSorter layerSorter; + CCLayerSorter layerSorter; int dummyMaxTextureSize = 512; // Sanity check: The test itself should create the root layer's render surface, so @@ -33,10 +33,10 @@ void executeCalculateDrawTransformsAndVisibility(LayerImpl* root, std::vector<La ASSERT_TRUE(root->renderSurface()); ASSERT_FALSE(renderSurfaceLayerList.size()); - LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); + CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &layerSorter, dummyMaxTextureSize, renderSurfaceLayerList); } -void clearDamageForAllSurfaces(LayerImpl* layer) +void clearDamageForAllSurfaces(CCLayerImpl* layer) { if (layer->renderSurface()) layer->renderSurface()->damageTracker()->didDrawDamagedArea(); @@ -46,29 +46,29 @@ void clearDamageForAllSurfaces(LayerImpl* layer) clearDamageForAllSurfaces(layer->children()[i]); } -void emulateDrawingOneFrame(LayerImpl* root) +void emulateDrawingOneFrame(CCLayerImpl* root) { // This emulates only the steps that are relevant to testing the damage tracker: // 1. computing the render passes and layerlists // 2. updating all damage trackers in the correct order // 3. resetting all updateRects and propertyChanged flags for all layers and surfaces. - std::vector<LayerImpl*> renderSurfaceLayerList; + std::vector<CCLayerImpl*> renderSurfaceLayerList; executeCalculateDrawTransformsAndVisibility(root, renderSurfaceLayerList); // Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors. for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) { - RenderSurfaceImpl* targetSurface = renderSurfaceLayerList[i]->renderSurface(); + CCRenderSurface* targetSurface = renderSurfaceLayerList[i]->renderSurface(); targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), targetSurface->surfacePropertyChangedOnlyFromDescendant(), targetSurface->contentRect(), renderSurfaceLayerList[i]->maskLayer(), renderSurfaceLayerList[i]->filters()); } root->resetAllChangeTrackingForSubtree(); } -scoped_ptr<LayerImpl> createTestTreeWithOneSurface() +scoped_ptr<CCLayerImpl> createTestTreeWithOneSurface() { - scoped_ptr<LayerImpl> root = LayerImpl::create(1); - scoped_ptr<LayerImpl> child = LayerImpl::create(2); + scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -88,17 +88,17 @@ scoped_ptr<LayerImpl> createTestTreeWithOneSurface() return root.Pass(); } -scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces() +scoped_ptr<CCLayerImpl> createTestTreeWithTwoSurfaces() { // This test tree has two render surfaces: one for the root, and one for // child1. Additionally, the root has a second child layer, and child1 has two // children of its own. - scoped_ptr<LayerImpl> root = LayerImpl::create(1); - scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); - scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); - scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); - scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5); + scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); + scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2); + scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); + scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); + scoped_ptr<CCLayerImpl> grandChild2 = CCLayerImpl::create(5); root->setPosition(FloatPoint::zero()); root->setAnchorPoint(FloatPoint::zero()); @@ -141,9 +141,9 @@ scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces() return root.Pass(); } -scoped_ptr<LayerImpl> createAndSetUpTestTreeWithOneSurface() +scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithOneSurface() { - scoped_ptr<LayerImpl> root = createTestTreeWithOneSurface(); + scoped_ptr<CCLayerImpl> root = createTestTreeWithOneSurface(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -152,9 +152,9 @@ scoped_ptr<LayerImpl> createAndSetUpTestTreeWithOneSurface() return root.Pass(); } -scoped_ptr<LayerImpl> createAndSetUpTestTreeWithTwoSurfaces() +scoped_ptr<CCLayerImpl> createAndSetUpTestTreeWithTwoSurfaces() { - scoped_ptr<LayerImpl> root = createTestTreeWithTwoSurfaces(); + scoped_ptr<CCLayerImpl> root = createTestTreeWithTwoSurfaces(); // Setup includes going past the first frame which always damages everything, so // that we can actually perform specific tests. @@ -163,18 +163,18 @@ scoped_ptr<LayerImpl> createAndSetUpTestTreeWithTwoSurfaces() return root.Pass(); } -class DamageTrackerTest : public testing::Test { +class CCDamageTrackerTest : public testing::Test { private: // For testing purposes, fake that we are on the impl thread. DebugScopedSetImplThread setImplThread; }; -TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface) +TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithOneSurface) { // Sanity check that the simple test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); EXPECT_EQ(2u, root->renderSurface()->layerList().size()); EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id()); @@ -184,15 +184,15 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) +TEST_F(CCDamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) { // Sanity check that the complex test tree will actually produce the expected render // surfaces and layer lists. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* child2 = root->children()[1]; + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* child2 = root->children()[1]; FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect(); FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); @@ -206,10 +206,10 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForUpdateRects) +TEST_F(CCDamageTrackerTest, verifyDamageForUpdateRects) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; // CASE 1: Setting the update rect should cause the corresponding damage to the surface. // @@ -240,10 +240,10 @@ TEST_F(DamageTrackerTest, verifyDamageForUpdateRects) EXPECT_FLOAT_RECT_EQ(FloatRect(120, 125, 1, 2), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges) +TEST_F(CCDamageTrackerTest, verifyDamageForPropertyChanges) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; // CASE 1: The layer's property changed flag takes priority over update rect. // @@ -281,13 +281,13 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges) EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForTransformedLayer) { // If a layer is transformed, the damage rect should still enclose the entire // transformed layer. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; WebTransformationMatrix rotation; rotation.rotate(45); @@ -317,7 +317,7 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer) EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForPerspectiveClippedLayer) { // If a layer has a perspective transform that causes w < 0, then not clipping the // layer can cause an invalid damage rect. This test checks that the w < 0 case is @@ -329,8 +329,8 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // and positioned so that the right-most bound rect will be approximately 501 units in root surface space. // - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; WebTransformationMatrix transform; transform.translate3d(500, 500, 0); @@ -349,7 +349,7 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer) // otherwise this test is not actually testing the intended scenario. FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100))); bool clipped = false; - MathUtil::mapQuad(transform, testQuad, clipped); + CCMathUtil::mapQuad(transform, testQuad, clipped); EXPECT_TRUE(clipped); // Damage the child without moving it. @@ -364,10 +364,10 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer) EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout)); } -TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface) +TEST_F(CCDamageTrackerTest, verifyDamageForBlurredSurface) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; WebFilterOperations filters; filters.append(WebFilterOperation::createBlurFilter(5)); @@ -392,11 +392,11 @@ TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface) EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild) +TEST_F(CCDamageTrackerTest, verifyDamageForBackgroundBlurredChild) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* child2 = root->children()[1]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* child2 = root->children()[1]; // Allow us to set damage on child1 too. child1->setDrawsContent(true); @@ -495,16 +495,16 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild) EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingLayer) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child1 = root->children()[0]; // CASE 1: Adding a new layer should cause the appropriate damage. // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -535,16 +535,16 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForNewUnchangedLayer) { // If child2 is added to the layer tree, but it doesn't have any explicit damage of // its own, it should still indeed damage the target surface. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -566,15 +566,15 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) +TEST_F(CCDamageTrackerTest, verifyDamageForMultipleLayers) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child1 = root->children()[0]; // In this test we don't want the above tree manipulation to be considered part of the same frame. clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); + scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3); child2->setPosition(FloatPoint(400, 380)); child2->setAnchorPoint(FloatPoint::zero()); child2->setBounds(IntSize(6, 8)); @@ -582,7 +582,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) child2->setDrawsContent(true); root->addChild(child2.Pass()); } - LayerImpl* child2 = root->children()[1]; + CCLayerImpl* child2 = root->children()[1]; emulateDrawingOneFrame(root.get()); // Damaging two layers simultaneously should cause combined damage. @@ -596,12 +596,12 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 303, 284), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces) +TEST_F(CCDamageTrackerTest, verifyDamageForNestedSurfaces) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* child2 = root->children()[1]; - LayerImpl* grandChild1 = root->children()[0]->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* child2 = root->children()[1]; + CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -628,7 +628,7 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(11, 11, 295, 297), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) { // If descendant layer changes and affects the content bounds of the render surface, // then the entire descendant surface should be damaged, and it should damage its @@ -637,9 +637,9 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) // This is a tricky case, since only the first grandChild changes, but the entire // surface should be marked dirty. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* grandChild1 = root->children()[0]->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* grandChild1 = root->children()[0]->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -657,11 +657,11 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 23), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) +TEST_F(CCDamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) { // An ancestor/owning layer changes that affects the position/transform of the render // surface. Note that in this case, the layerPropertyChanged flag already propagates - // to the subtree (tested in LayerImpltest), which damages the entire child1 + // to the subtree (tested in CCLayerImpltest), which damages the entire child1 // surface, but the damage tracker still needs the correct logic to compute the // exposed region on the root surface. @@ -670,8 +670,8 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) // should be completely unchanged, since we are only transforming it, while the // root surface would be damaged appropriately. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -690,10 +690,10 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer) EXPECT_FLOAT_RECT_EQ(FloatRect(240, 240, 66, 68), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) +TEST_F(CCDamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -734,10 +734,10 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces) EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged) +TEST_F(CCDamageTrackerTest, verifyNoDamageWhenNothingChanged) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -760,10 +760,10 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged) EXPECT_TRUE(rootDamageRect.isEmpty()); } -TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) +TEST_F(CCDamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; FloatRect childDamageRect; FloatRect rootDamageRect; @@ -778,12 +778,12 @@ TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent) EXPECT_TRUE(rootDamageRect.isEmpty()); } -TEST_F(DamageTrackerTest, verifyDamageForReplica) +TEST_F(CCDamageTrackerTest, verifyDamageForReplica) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* grandChild1 = child1->children()[0]; - LayerImpl* grandChild2 = child1->children()[1]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* grandChild1 = child1->children()[0]; + CCLayerImpl* grandChild2 = child1->children()[1]; // Damage on a surface that has a reflection should cause the target surface to // receive the surface's damage and the surface's reflected damage. @@ -793,7 +793,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) // contentBounds of the surface. grandChild2->setPosition(FloatPoint(180, 180)); { - scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6); + scoped_ptr<CCLayerImpl> grandChild3 = CCLayerImpl::create(6); grandChild3->setPosition(FloatPoint(240, 240)); grandChild3->setAnchorPoint(FloatPoint::zero()); grandChild3->setBounds(IntSize(10, 10)); @@ -808,7 +808,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) // clearDamageForAllSurfaces(root.get()); { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(7); + scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(7); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; @@ -851,7 +851,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) // CASE 3: removing the reflection should cause the entire region including reflection // to damage the target surface. clearDamageForAllSurfaces(root.get()); - grandChild1->setReplicaLayer(scoped_ptr<LayerImpl>()); + grandChild1->setReplicaLayer(scoped_ptr<CCLayerImpl>()); emulateDrawingOneFrame(root.get()); ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width()); ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height()); @@ -864,10 +864,10 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica) EXPECT_FLOAT_RECT_EQ(FloatRect(289, 305, 12, 8), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForMask) +TEST_F(CCDamageTrackerTest, verifyDamageForMask) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; // In the current implementation of the damage tracker, changes to mask layers should // damage the entire corresponding surface. @@ -876,19 +876,19 @@ TEST_F(DamageTrackerTest, verifyDamageForMask) // Set up the mask layer. { - scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3); + scoped_ptr<CCLayerImpl> maskLayer = CCLayerImpl::create(3); maskLayer->setPosition(child->position()); maskLayer->setAnchorPoint(FloatPoint::zero()); maskLayer->setBounds(child->bounds()); maskLayer->setContentBounds(child->bounds()); child->setMaskLayer(maskLayer.Pass()); } - LayerImpl* maskLayer = child->maskLayer(); + CCLayerImpl* maskLayer = child->maskLayer(); // Add opacity and a grandChild so that the render surface persists even after we remove the mask. child->setOpacity(0.5); { - scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4); + scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(4); grandChild->setPosition(FloatPoint(2, 2)); grandChild->setAnchorPoint(FloatPoint::zero()); grandChild->setBounds(IntSize(2, 2)); @@ -937,7 +937,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask) // Then test mask removal. clearDamageForAllSurfaces(root.get()); - child->setMaskLayer(scoped_ptr<LayerImpl>()); + child->setMaskLayer(scoped_ptr<CCLayerImpl>()); ASSERT_TRUE(child->layerPropertyChanged()); emulateDrawingOneFrame(root.get()); @@ -948,11 +948,11 @@ TEST_F(DamageTrackerTest, verifyDamageForMask) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) +TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* grandChild1 = child1->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* grandChild1 = child1->children()[0]; // Changes to a replica's mask should not damage the original surface, because it is // not masked. But it does damage the ancestor target surface. @@ -961,7 +961,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) // Create a reflection about the left edge of grandChild1. { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6); + scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint::zero()); WebTransformationMatrix reflection; @@ -969,18 +969,18 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.Pass()); } - LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); + CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); + scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); } - LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); + CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); emulateDrawingOneFrame(root.get()); @@ -1001,7 +1001,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) // CASE 2: removing the replica mask damages only the reflected region on the target surface. // clearDamageForAllSurfaces(root.get()); - grandChild1Replica->setMaskLayer(scoped_ptr<LayerImpl>()); + grandChild1Replica->setMaskLayer(scoped_ptr<CCLayerImpl>()); emulateDrawingOneFrame(root.get()); grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect(); @@ -1011,11 +1011,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask) EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) +TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); - LayerImpl* child1 = root->children()[0]; - LayerImpl* grandChild1 = child1->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces(); + CCLayerImpl* child1 = root->children()[0]; + CCLayerImpl* grandChild1 = child1->children()[0]; // Verify that the correct replicaOriginTransform is used for the replicaMask; clearDamageForAllSurfaces(root.get()); @@ -1023,7 +1023,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point. { - scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6); + scoped_ptr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6); grandChild1Replica->setPosition(FloatPoint::zero()); grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested. WebTransformationMatrix reflection; @@ -1031,18 +1031,18 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) grandChild1Replica->setTransform(reflection); grandChild1->setReplicaLayer(grandChild1Replica.Pass()); } - LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); + CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer(); // Set up the mask layer on the replica layer { - scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); + scoped_ptr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7); replicaMaskLayer->setPosition(FloatPoint::zero()); replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested. replicaMaskLayer->setBounds(grandChild1->bounds()); replicaMaskLayer->setContentBounds(grandChild1->bounds()); grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); } - LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); + CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); emulateDrawingOneFrame(root.get()); @@ -1059,10 +1059,10 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor) EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage) +TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage) { - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; // Case 1: This test ensures that when the tracker is forced to have full damage, that // it takes priority over any other partial damage. @@ -1084,16 +1084,16 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage) EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); } -TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList) +TEST_F(CCDamageTrackerTest, verifyDamageForEmptyLayerList) { // Though it should never happen, its a good idea to verify that the damage tracker // does not crash when it receives an empty layerList. - scoped_ptr<LayerImpl> root = LayerImpl::create(1); + scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1); root->createRenderSurface(); ASSERT_TRUE(root == root->renderTarget()); - RenderSurfaceImpl* targetSurface = root->renderSurface(); + CCRenderSurface* targetSurface = root->renderSurface(); targetSurface->clearLayerLists(); targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, WebFilterOperations()); @@ -1101,12 +1101,12 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList) EXPECT_TRUE(damageRect.isEmpty()); } -TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset) +TEST_F(CCDamageTrackerTest, verifyDamageAccumulatesUntilReset) { // If damage is not cleared, it should accumulate. - scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); - LayerImpl* child = root->children()[0]; + scoped_ptr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + CCLayerImpl* child = root->children()[0]; clearDamageForAllSurfaces(root.get()); child->setUpdateRect(FloatRect(10, 11, 1, 2)); |