Chromium Code Reviews| 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include "cc/animation/keyframed_animation_curve.h" | 7 #include "cc/animation/keyframed_animation_curve.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 10 #include "cc/resources/layer_painter.h" | 10 #include "cc/resources/layer_painter.h" |
| 11 #include "cc/test/animation_test_common.h" | 11 #include "cc/test/animation_test_common.h" |
| 12 #include "cc/test/fake_impl_proxy.h" | 12 #include "cc/test/fake_impl_proxy.h" |
| 13 #include "cc/test/fake_layer_tree_host_client.h" | 13 #include "cc/test/fake_layer_tree_host_client.h" |
| 14 #include "cc/test/fake_layer_tree_host_impl.h" | 14 #include "cc/test/fake_layer_tree_host_impl.h" |
| 15 #include "cc/test/geometry_test_utils.h" | 15 #include "cc/test/geometry_test_utils.h" |
| 16 #include "cc/test/layer_test_common.h" | 16 #include "cc/test/layer_test_common.h" |
| 17 #include "cc/test/test_shared_bitmap_manager.h" | |
| 17 #include "cc/trees/layer_tree_host.h" | 18 #include "cc/trees/layer_tree_host.h" |
| 18 #include "cc/trees/single_thread_proxy.h" | 19 #include "cc/trees/single_thread_proxy.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "ui/gfx/transform.h" | 22 #include "ui/gfx/transform.h" |
| 22 | 23 |
| 23 using ::testing::AnyNumber; | 24 using ::testing::AnyNumber; |
| 24 using ::testing::AtLeast; | 25 using ::testing::AtLeast; |
| 25 using ::testing::Mock; | 26 using ::testing::Mock; |
| 26 using ::testing::StrictMock; | 27 using ::testing::StrictMock; |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 | 797 |
| 797 child->SetReplicaLayer(replica_replacement.get()); | 798 child->SetReplicaLayer(replica_replacement.get()); |
| 798 EXPECT_EQ(NULL, replica->parent()); | 799 EXPECT_EQ(NULL, replica->parent()); |
| 799 EXPECT_EQ(child, replica_replacement->parent()); | 800 EXPECT_EQ(child, replica_replacement->parent()); |
| 800 | 801 |
| 801 EXPECT_EQ(replica, replica->mask_layer()->parent()); | 802 EXPECT_EQ(replica, replica->mask_layer()->parent()); |
| 802 } | 803 } |
| 803 | 804 |
| 804 class LayerTreeHostFactory { | 805 class LayerTreeHostFactory { |
| 805 public: | 806 public: |
| 806 LayerTreeHostFactory() | 807 LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D) { |
| 807 : client_(FakeLayerTreeHostClient::DIRECT_3D) {} | 808 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
|
danakj
2014/03/18 23:42:44
do this as constructor initialization like client_
| |
| 809 } | |
| 808 | 810 |
| 809 scoped_ptr<LayerTreeHost> Create() { | 811 scoped_ptr<LayerTreeHost> Create() { |
| 810 return LayerTreeHost::CreateSingleThreaded(&client_, | 812 return LayerTreeHost::CreateSingleThreaded(&client_, |
| 811 &client_, | 813 &client_, |
| 812 NULL, | 814 shared_bitmap_manager_.get(), |
| 813 LayerTreeSettings()).Pass(); | 815 LayerTreeSettings()).Pass(); |
| 814 } | 816 } |
| 815 | 817 |
| 816 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { | 818 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { |
| 817 return LayerTreeHost::CreateSingleThreaded(&client_, | 819 return LayerTreeHost::CreateSingleThreaded( |
| 818 &client_, | 820 &client_, &client_, shared_bitmap_manager_.get(), settings) |
| 819 NULL, | 821 .Pass(); |
| 820 settings).Pass(); | |
| 821 } | 822 } |
| 822 | 823 |
| 823 private: | 824 private: |
| 824 FakeLayerTreeHostClient client_; | 825 FakeLayerTreeHostClient client_; |
| 826 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | |
| 825 }; | 827 }; |
| 826 | 828 |
| 827 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { | 829 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { |
| 828 EXPECT_EQ(host, layer->layer_tree_host()); | 830 EXPECT_EQ(host, layer->layer_tree_host()); |
| 829 | 831 |
| 830 for (size_t i = 0; i < layer->children().size(); ++i) | 832 for (size_t i = 0; i < layer->children().size(); ++i) |
| 831 AssertLayerTreeHostMatchesForSubtree(layer->children()[i].get(), host); | 833 AssertLayerTreeHostMatchesForSubtree(layer->children()[i].get(), host); |
| 832 | 834 |
| 833 if (layer->mask_layer()) | 835 if (layer->mask_layer()) |
| 834 AssertLayerTreeHostMatchesForSubtree(layer->mask_layer(), host); | 836 AssertLayerTreeHostMatchesForSubtree(layer->mask_layer(), host); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " | 1078 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " |
| 1077 << host_opaque << "\n"; | 1079 << host_opaque << "\n"; |
| 1078 } | 1080 } |
| 1079 } | 1081 } |
| 1080 } | 1082 } |
| 1081 } | 1083 } |
| 1082 } | 1084 } |
| 1083 | 1085 |
| 1084 } // namespace | 1086 } // namespace |
| 1085 } // namespace cc | 1087 } // namespace cc |
| OLD | NEW |