| OLD | NEW |
| 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 "cc/tree_synchronizer.h" | 5 #include "cc/tree_synchronizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
| 10 #include "cc/layer_animation_controller.h" | 10 #include "cc/layer_animation_controller.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 protected: | 137 protected: |
| 138 FakeImplProxy m_proxy; | 138 FakeImplProxy m_proxy; |
| 139 FakeLayerTreeHostImpl m_hostImpl; | 139 FakeLayerTreeHostImpl m_hostImpl; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Attempts to synchronizes a null tree. This should not crash, and should | 142 // Attempts to synchronizes a null tree. This should not crash, and should |
| 143 // return a null tree. | 143 // return a null tree. |
| 144 TEST_F(TreeSynchronizerTest, syncNullTree) | 144 TEST_F(TreeSynchronizerTest, syncNullTree) |
| 145 { | 145 { |
| 146 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(0, scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); | 146 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(static_cast<Layer*>(NULL), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); |
| 147 | 147 |
| 148 EXPECT_TRUE(!layerImplTreeRoot.get()); | 148 EXPECT_TRUE(!layerImplTreeRoot.get()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Constructs a very simple tree and synchronizes it without trying to reuse any
preexisting layers. | 151 // Constructs a very simple tree and synchronizes it without trying to reuse any
preexisting layers. |
| 152 TEST_F(TreeSynchronizerTest, syncSimpleTreeFromEmpty) | 152 TEST_F(TreeSynchronizerTest, syncSimpleTreeFromEmpty) |
| 153 { | 153 { |
| 154 scoped_refptr<Layer> layerTreeRoot = Layer::create(); | 154 scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
| 155 layerTreeRoot->addChild(Layer::create()); | 155 layerTreeRoot->addChild(Layer::create()); |
| 156 layerTreeRoot->addChild(Layer::create()); | 156 layerTreeRoot->addChild(Layer::create()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); | 395 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); |
| 396 TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get(
)); | 396 TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get(
)); |
| 397 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), m_hostImpl.activeTree()); | 397 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), m_hostImpl.activeTree()); |
| 398 | 398 |
| 399 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); | 399 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace | 402 } // namespace |
| 403 } // namespace cc | 403 } // namespace cc |
| OLD | NEW |