Index: cc/tree_synchronizer_unittest.cc |
diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc |
index 9d9320b1d54fc0309ee9eb72457dc11b9eae35c8..dff1045a55b16e50b6cb6593b15f93be6be149b4 100644 |
--- a/cc/tree_synchronizer_unittest.cc |
+++ b/cc/tree_synchronizer_unittest.cc |
@@ -20,64 +20,64 @@ using namespace WebKitTests; |
namespace { |
-class MockCCLayerImpl : public CCLayerImpl { |
+class MockLayerImpl : public LayerImpl { |
public: |
- static scoped_ptr<MockCCLayerImpl> create(int layerId) |
+ static scoped_ptr<MockLayerImpl> create(int layerId) |
{ |
- return make_scoped_ptr(new MockCCLayerImpl(layerId)); |
+ return make_scoped_ptr(new MockLayerImpl(layerId)); |
} |
- virtual ~MockCCLayerImpl() |
+ virtual ~MockLayerImpl() |
{ |
- if (m_ccLayerDestructionList) |
- m_ccLayerDestructionList->append(id()); |
+ if (m_layerImplDestructionList) |
+ m_layerImplDestructionList->append(id()); |
} |
- void setCCLayerDestructionList(Vector<int>* list) { m_ccLayerDestructionList = list; } |
+ void setLayerImplDestructionList(Vector<int>* list) { m_layerImplDestructionList = list; } |
private: |
- MockCCLayerImpl(int layerId) |
- : CCLayerImpl(layerId) |
- , m_ccLayerDestructionList(0) |
+ MockLayerImpl(int layerId) |
+ : LayerImpl(layerId) |
+ , m_layerImplDestructionList(0) |
{ |
} |
- Vector<int>* m_ccLayerDestructionList; |
+ Vector<int>* m_layerImplDestructionList; |
}; |
-class MockLayerChromium : public LayerChromium { |
+class MockLayer : public Layer { |
public: |
- static scoped_refptr<MockLayerChromium> create(Vector<int>* ccLayerDestructionList) |
+ static scoped_refptr<MockLayer> create(Vector<int>* layerImplDestructionList) |
{ |
- return make_scoped_refptr(new MockLayerChromium(ccLayerDestructionList)); |
+ return make_scoped_refptr(new MockLayer(layerImplDestructionList)); |
} |
- virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE |
+ virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE |
{ |
- return MockCCLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); |
+ return MockLayerImpl::create(m_layerId).PassAs<LayerImpl>(); |
} |
- virtual void pushPropertiesTo(CCLayerImpl* ccLayer) OVERRIDE |
+ virtual void pushPropertiesTo(LayerImpl* layerImpl) OVERRIDE |
{ |
- LayerChromium::pushPropertiesTo(ccLayer); |
+ Layer::pushPropertiesTo(layerImpl); |
- MockCCLayerImpl* mockCCLayer = static_cast<MockCCLayerImpl*>(ccLayer); |
- mockCCLayer->setCCLayerDestructionList(m_ccLayerDestructionList); |
+ MockLayerImpl* mockLayerImpl = static_cast<MockLayerImpl*>(layerImpl); |
+ mockLayerImpl->setLayerImplDestructionList(m_layerImplDestructionList); |
} |
private: |
- MockLayerChromium(Vector<int>* ccLayerDestructionList) |
- : LayerChromium() |
- , m_ccLayerDestructionList(ccLayerDestructionList) |
+ MockLayer(Vector<int>* layerImplDestructionList) |
+ : Layer() |
+ , m_layerImplDestructionList(layerImplDestructionList) |
{ |
} |
- virtual ~MockLayerChromium() { } |
+ virtual ~MockLayer() { } |
- Vector<int>* m_ccLayerDestructionList; |
+ Vector<int>* m_layerImplDestructionList; |
}; |
-class FakeLayerAnimationController : public CCLayerAnimationController { |
+class FakeLayerAnimationController : public LayerAnimationController { |
public: |
- static scoped_ptr<FakeLayerAnimationController> create(CCLayerAnimationControllerClient* client) |
+ static scoped_ptr<FakeLayerAnimationController> create(LayerAnimationControllerClient* client) |
{ |
return make_scoped_ptr(new FakeLayerAnimationController(client)); |
} |
@@ -85,46 +85,46 @@ public: |
bool synchronizedAnimations() const { return m_synchronizedAnimations; } |
private: |
- explicit FakeLayerAnimationController(CCLayerAnimationControllerClient* client) |
- : CCLayerAnimationController(client) |
+ explicit FakeLayerAnimationController(LayerAnimationControllerClient* client) |
+ : LayerAnimationController(client) |
, m_synchronizedAnimations(false) |
{ |
} |
- virtual void pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl) |
+ virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl) |
{ |
- CCLayerAnimationController::pushAnimationUpdatesTo(controllerImpl); |
+ LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); |
m_synchronizedAnimations = true; |
} |
bool m_synchronizedAnimations; |
}; |
-void expectTreesAreIdentical(LayerChromium* layer, CCLayerImpl* ccLayer, CCLayerTreeHostImpl* hostImpl) |
+void expectTreesAreIdentical(Layer* layer, LayerImpl* layerImpl, LayerTreeHostImpl* hostImpl) |
{ |
ASSERT_TRUE(layer); |
- ASSERT_TRUE(ccLayer); |
+ ASSERT_TRUE(layerImpl); |
- EXPECT_EQ(layer->id(), ccLayer->id()); |
- EXPECT_EQ(ccLayer->layerTreeHostImpl(), hostImpl); |
+ EXPECT_EQ(layer->id(), layerImpl->id()); |
+ EXPECT_EQ(layerImpl->layerTreeHostImpl(), hostImpl); |
- EXPECT_EQ(layer->nonFastScrollableRegion(), ccLayer->nonFastScrollableRegion()); |
+ EXPECT_EQ(layer->nonFastScrollableRegion(), layerImpl->nonFastScrollableRegion()); |
- ASSERT_EQ(!!layer->maskLayer(), !!ccLayer->maskLayer()); |
+ ASSERT_EQ(!!layer->maskLayer(), !!layerImpl->maskLayer()); |
if (layer->maskLayer()) |
- expectTreesAreIdentical(layer->maskLayer(), ccLayer->maskLayer(), hostImpl); |
+ expectTreesAreIdentical(layer->maskLayer(), layerImpl->maskLayer(), hostImpl); |
- ASSERT_EQ(!!layer->replicaLayer(), !!ccLayer->replicaLayer()); |
+ ASSERT_EQ(!!layer->replicaLayer(), !!layerImpl->replicaLayer()); |
if (layer->replicaLayer()) |
- expectTreesAreIdentical(layer->replicaLayer(), ccLayer->replicaLayer(), hostImpl); |
+ expectTreesAreIdentical(layer->replicaLayer(), layerImpl->replicaLayer(), hostImpl); |
- const std::vector<scoped_refptr<LayerChromium> >& layerChildren = layer->children(); |
- const ScopedPtrVector<CCLayerImpl>& ccLayerChildren = ccLayer->children(); |
+ const std::vector<scoped_refptr<Layer> >& layerChildren = layer->children(); |
+ const ScopedPtrVector<LayerImpl>& layerImplChildren = layerImpl->children(); |
- ASSERT_EQ(layerChildren.size(), ccLayerChildren.size()); |
+ ASSERT_EQ(layerChildren.size(), layerImplChildren.size()); |
for (size_t i = 0; i < layerChildren.size(); ++i) |
- expectTreesAreIdentical(layerChildren[i].get(), ccLayerChildren[i], hostImpl); |
+ expectTreesAreIdentical(layerChildren[i].get(), layerImplChildren[i], hostImpl); |
} |
// Attempts to synchronizes a null tree. This should not crash, and should |
@@ -133,9 +133,9 @@ TEST(TreeSynchronizerTest, syncNullTree) |
{ |
DebugScopedSetImplThread impl; |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<CCLayerImpl>(), 0); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(0, scoped_ptr<LayerImpl>(), 0); |
- EXPECT_TRUE(!ccLayerTreeRoot.get()); |
+ EXPECT_TRUE(!layerImplTreeRoot.get()); |
} |
// Constructs a very simple tree and synchronizes it without trying to reuse any preexisting layers. |
@@ -143,89 +143,89 @@ TEST(TreeSynchronizerTest, syncSimpleTreeFromEmpty) |
{ |
DebugScopedSetImplThread impl; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); |
- layerTreeRoot->addChild(LayerChromium::create()); |
- layerTreeRoot->addChild(LayerChromium::create()); |
+ scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
+ layerTreeRoot->addChild(Layer::create()); |
+ layerTreeRoot->addChild(Layer::create()); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
} |
// Constructs a very simple tree and synchronizes it attempting to reuse some layers |
TEST(TreeSynchronizerTest, syncSimpleTreeReusingLayers) |
{ |
DebugScopedSetImplThread impl; |
- Vector<int> ccLayerDestructionList; |
+ Vector<int> layerImplDestructionList; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); |
- layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
- layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); |
+ layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
+ layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- // Add a new layer to the LayerChromium side |
- layerTreeRoot->children()[0]->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ // Add a new layer to the Layer side |
+ layerTreeRoot->children()[0]->addChild(MockLayer::create(&layerImplDestructionList)); |
// Remove one. |
layerTreeRoot->children()[1]->removeFromParent(); |
- int secondCCLayerId = ccLayerTreeRoot->children()[1]->id(); |
+ int secondLayerImplId = layerImplTreeRoot->children()[1]->id(); |
- // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one CCLayerImpl. |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ // Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one LayerImpl. |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- ASSERT_EQ(1u, ccLayerDestructionList.size()); |
- EXPECT_EQ(secondCCLayerId, ccLayerDestructionList[0]); |
+ ASSERT_EQ(1u, layerImplDestructionList.size()); |
+ EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]); |
} |
// Constructs a very simple tree and checks that a stacking-order change is tracked properly. |
TEST(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange) |
{ |
DebugScopedSetImplThread impl; |
- Vector<int> ccLayerDestructionList; |
+ Vector<int> layerImplDestructionList; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
// Set up the tree and sync once. child2 needs to be synced here, too, even though we |
// remove it to set up the intended scenario. |
- scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); |
- scoped_refptr<LayerChromium> child2 = MockLayerChromium::create(&ccLayerDestructionList); |
- layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); |
+ scoped_refptr<Layer> child2 = MockLayer::create(&layerImplDestructionList); |
+ layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
layerTreeRoot->addChild(child2); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
- ccLayerTreeRoot->resetAllChangeTrackingForSubtree(); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
+ layerImplTreeRoot->resetAllChangeTrackingForSubtree(); |
// re-insert the layer and sync again. |
child2->removeFromParent(); |
layerTreeRoot->addChild(child2); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
// Check that the impl thread properly tracked the change. |
- EXPECT_FALSE(ccLayerTreeRoot->layerPropertyChanged()); |
- EXPECT_FALSE(ccLayerTreeRoot->children()[0]->layerPropertyChanged()); |
- EXPECT_TRUE(ccLayerTreeRoot->children()[1]->layerPropertyChanged()); |
+ EXPECT_FALSE(layerImplTreeRoot->layerPropertyChanged()); |
+ EXPECT_FALSE(layerImplTreeRoot->children()[0]->layerPropertyChanged()); |
+ EXPECT_TRUE(layerImplTreeRoot->children()[1]->layerPropertyChanged()); |
} |
TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) |
{ |
DebugScopedSetImplThread impl; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); |
- layerTreeRoot->addChild(LayerChromium::create()); |
- layerTreeRoot->addChild(LayerChromium::create()); |
+ scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
+ layerTreeRoot->addChild(Layer::create()); |
+ layerTreeRoot->addChild(Layer::create()); |
// Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through. |
FloatPoint rootPosition = FloatPoint(2.3f, 7.4f); |
@@ -237,48 +237,48 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties) |
IntSize secondChildBounds = IntSize(25, 53); |
layerTreeRoot->children()[1]->setBounds(secondChildBounds); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- // Check that the property values we set on the LayerChromium tree are reflected in the CCLayerImpl tree. |
- FloatPoint rootCCLayerPosition = ccLayerTreeRoot->position(); |
- EXPECT_EQ(rootPosition.x(), rootCCLayerPosition.x()); |
- EXPECT_EQ(rootPosition.y(), rootCCLayerPosition.y()); |
+ // Check that the property values we set on the Layer tree are reflected in the LayerImpl tree. |
+ FloatPoint rootLayerImplPosition = layerImplTreeRoot->position(); |
+ EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x()); |
+ EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y()); |
- EXPECT_EQ(firstChildOpacity, ccLayerTreeRoot->children()[0]->opacity()); |
+ EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity()); |
- IntSize secondCCLayerChildBounds = ccLayerTreeRoot->children()[1]->bounds(); |
- EXPECT_EQ(secondChildBounds.width(), secondCCLayerChildBounds.width()); |
- EXPECT_EQ(secondChildBounds.height(), secondCCLayerChildBounds.height()); |
+ IntSize secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds(); |
+ EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width()); |
+ EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height()); |
} |
-TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) |
+TEST(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange) |
{ |
DebugScopedSetImplThread impl; |
- Vector<int> ccLayerDestructionList; |
+ Vector<int> layerImplDestructionList; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
// Set up a tree with this sort of structure: |
// root --- A --- B ---+--- C |
// | |
// +--- D |
- scoped_refptr<LayerChromium> layerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); |
- layerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> layerTreeRoot = MockLayer::create(&layerImplDestructionList); |
+ layerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
- scoped_refptr<LayerChromium> layerA = layerTreeRoot->children()[0].get(); |
- layerA->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> layerA = layerTreeRoot->children()[0].get(); |
+ layerA->addChild(MockLayer::create(&layerImplDestructionList)); |
- scoped_refptr<LayerChromium> layerB = layerA->children()[0].get(); |
- layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> layerB = layerA->children()[0].get(); |
+ layerB->addChild(MockLayer::create(&layerImplDestructionList)); |
- scoped_refptr<LayerChromium> layerC = layerB->children()[0].get(); |
- layerB->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
- scoped_refptr<LayerChromium> layerD = layerB->children()[1].get(); |
+ scoped_refptr<Layer> layerC = layerB->children()[0].get(); |
+ layerB->addChild(MockLayer::create(&layerImplDestructionList)); |
+ scoped_refptr<Layer> layerD = layerB->children()[1].get(); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
// Now restructure the tree to look like this: |
// root --- D ---+--- A |
@@ -294,45 +294,45 @@ TEST(TreeSynchronizerTest, reuseCCLayersAfterStructuralChange) |
layerB->removeAllChildren(); |
layerC->addChild(layerB); |
- // After another synchronize our trees should match and we should not have destroyed any CCLayerImpls |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ // After another synchronize our trees should match and we should not have destroyed any LayerImpls |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- EXPECT_EQ(0u, ccLayerDestructionList.size()); |
+ EXPECT_EQ(0u, layerImplDestructionList.size()); |
} |
// Constructs a very simple tree, synchronizes it, then synchronizes to a totally new tree. All layers from the old tree should be deleted. |
TEST(TreeSynchronizerTest, syncSimpleTreeThenDestroy) |
{ |
DebugScopedSetImplThread impl; |
- Vector<int> ccLayerDestructionList; |
+ Vector<int> layerImplDestructionList; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> oldLayerTreeRoot = MockLayerChromium::create(&ccLayerDestructionList); |
- oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
- oldLayerTreeRoot->addChild(MockLayerChromium::create(&ccLayerDestructionList)); |
+ scoped_refptr<Layer> oldLayerTreeRoot = MockLayer::create(&layerImplDestructionList); |
+ oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
+ oldLayerTreeRoot->addChild(MockLayer::create(&layerImplDestructionList)); |
int oldTreeRootLayerId = oldLayerTreeRoot->id(); |
int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id(); |
int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id(); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(oldLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- // Remove all children on the LayerChromium side. |
+ // Remove all children on the Layer side. |
oldLayerTreeRoot->removeAllChildren(); |
- // Synchronize again. After the sync all CCLayerImpls from the old tree should be deleted. |
- scoped_refptr<LayerChromium> newLayerTreeRoot = LayerChromium::create(); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(newLayerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ // Synchronize again. After the sync all LayerImpls from the old tree should be deleted. |
+ scoped_refptr<Layer> newLayerTreeRoot = Layer::create(); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
- ASSERT_EQ(3u, ccLayerDestructionList.size()); |
- EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeRootLayerId)); |
- EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeFirstChildLayerId)); |
- EXPECT_TRUE(ccLayerDestructionList.contains(oldTreeSecondChildLayerId)); |
+ ASSERT_EQ(3u, layerImplDestructionList.size()); |
+ EXPECT_TRUE(layerImplDestructionList.contains(oldTreeRootLayerId)); |
+ EXPECT_TRUE(layerImplDestructionList.contains(oldTreeFirstChildLayerId)); |
+ EXPECT_TRUE(layerImplDestructionList.contains(oldTreeSecondChildLayerId)); |
} |
// Constructs+syncs a tree with mask, replica, and replica mask layers. |
@@ -340,64 +340,64 @@ TEST(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers) |
{ |
DebugScopedSetImplThread impl; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); |
- layerTreeRoot->addChild(LayerChromium::create()); |
- layerTreeRoot->addChild(LayerChromium::create()); |
- layerTreeRoot->addChild(LayerChromium::create()); |
+ scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
+ layerTreeRoot->addChild(Layer::create()); |
+ layerTreeRoot->addChild(Layer::create()); |
+ layerTreeRoot->addChild(Layer::create()); |
// First child gets a mask layer. |
- scoped_refptr<LayerChromium> maskLayer = LayerChromium::create(); |
+ scoped_refptr<Layer> maskLayer = Layer::create(); |
layerTreeRoot->children()[0]->setMaskLayer(maskLayer.get()); |
// Second child gets a replica layer. |
- scoped_refptr<LayerChromium> replicaLayer = LayerChromium::create(); |
+ scoped_refptr<Layer> replicaLayer = Layer::create(); |
layerTreeRoot->children()[1]->setReplicaLayer(replicaLayer.get()); |
// Third child gets a replica layer with a mask layer. |
- scoped_refptr<LayerChromium> replicaLayerWithMask = LayerChromium::create(); |
- scoped_refptr<LayerChromium> replicaMaskLayer = LayerChromium::create(); |
+ scoped_refptr<Layer> replicaLayerWithMask = Layer::create(); |
+ scoped_refptr<Layer> replicaMaskLayer = Layer::create(); |
replicaLayerWithMask->setMaskLayer(replicaMaskLayer.get()); |
layerTreeRoot->children()[2]->setReplicaLayer(replicaLayerWithMask.get()); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
// Remove the mask layer. |
layerTreeRoot->children()[0]->setMaskLayer(0); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
// Remove the replica layer. |
layerTreeRoot->children()[1]->setReplicaLayer(0); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
// Remove the replica mask. |
replicaLayerWithMask->setMaskLayer(0); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
- expectTreesAreIdentical(layerTreeRoot.get(), ccLayerTreeRoot.get(), hostImpl.get()); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get()); |
} |
TEST(TreeSynchronizerTest, synchronizeAnimations) |
{ |
DebugScopedSetImplThread impl; |
- CCLayerTreeSettings settings; |
- scoped_ptr<CCLayerTreeHostImpl> hostImpl = CCLayerTreeHostImpl::create(settings, 0); |
+ LayerTreeSettings settings; |
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0); |
- scoped_refptr<LayerChromium> layerTreeRoot = LayerChromium::create(); |
+ scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
FakeLayerAnimationControllerClient dummy; |
- layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy).PassAs<CCLayerAnimationController>()); |
+ layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::create(&dummy).PassAs<LayerAnimationController>()); |
EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); |
- scoped_ptr<CCLayerImpl> ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<CCLayerImpl>(), hostImpl.get()); |
- ccLayerTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), ccLayerTreeRoot.Pass(), hostImpl.get()); |
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.get()); |
EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerAnimationController())->synchronizedAnimations()); |
} |