| 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/trees/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 for (size_t i = 0; i < layer_children.size(); ++i) { | 183 for (size_t i = 0; i < layer_children.size(); ++i) { |
| 184 SCOPED_TRACE(base::StringPrintf("child layer %" PRIuS, i).c_str()); | 184 SCOPED_TRACE(base::StringPrintf("child layer %" PRIuS, i).c_str()); |
| 185 ExpectTreesAreIdentical( | 185 ExpectTreesAreIdentical( |
| 186 layer_children[i].get(), layer_impl_children[i], tree_impl); | 186 layer_children[i].get(), layer_impl_children[i], tree_impl); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 class TreeSynchronizerTest : public testing::Test { | 190 class TreeSynchronizerTest : public testing::Test { |
| 191 public: | 191 public: |
| 192 TreeSynchronizerTest() | 192 TreeSynchronizerTest() : host_(FakeLayerTreeHost::Create()) {} |
| 193 : client_(FakeLayerTreeHostClient::DIRECT_3D), | |
| 194 host_(FakeLayerTreeHost::Create(&client_)) {} | |
| 195 | 193 |
| 196 protected: | 194 protected: |
| 197 FakeLayerTreeHostClient client_; | |
| 198 scoped_ptr<FakeLayerTreeHost> host_; | 195 scoped_ptr<FakeLayerTreeHost> host_; |
| 199 }; | 196 }; |
| 200 | 197 |
| 201 // Attempts to synchronizes a null tree. This should not crash, and should | 198 // Attempts to synchronizes a null tree. This should not crash, and should |
| 202 // return a null tree. | 199 // return a null tree. |
| 203 TEST_F(TreeSynchronizerTest, SyncNullTree) { | 200 TEST_F(TreeSynchronizerTest, SyncNullTree) { |
| 204 scoped_ptr<LayerImpl> layer_impl_tree_root = | 201 scoped_ptr<LayerImpl> layer_impl_tree_root = |
| 205 TreeSynchronizer::SynchronizeTrees(static_cast<Layer*>(NULL), | 202 TreeSynchronizer::SynchronizeTrees(static_cast<Layer*>(NULL), |
| 206 scoped_ptr<LayerImpl>(), | 203 scoped_ptr<LayerImpl>(), |
| 207 host_->active_tree()); | 204 host_->active_tree()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 host_impl->active_tree()); | 748 host_impl->active_tree()); |
| 752 | 749 |
| 753 // The clip children should have been unhooked. | 750 // The clip children should have been unhooked. |
| 754 EXPECT_EQ(2u, intervening->children().size()); | 751 EXPECT_EQ(2u, intervening->children().size()); |
| 755 EXPECT_FALSE(clip_child2->clip_parent()); | 752 EXPECT_FALSE(clip_child2->clip_parent()); |
| 756 EXPECT_FALSE(additional_clip_child->clip_parent()); | 753 EXPECT_FALSE(additional_clip_child->clip_parent()); |
| 757 } | 754 } |
| 758 | 755 |
| 759 } // namespace | 756 } // namespace |
| 760 } // namespace cc | 757 } // namespace cc |
| OLD | NEW |