Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 202763002: Switch to use SharedBitmapManager all the time in cc_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_position_constraint_unittest.cc ('k') | cc/layers/layer_utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 25 matching lines...) Expand all
52 public: 53 public:
53 virtual void Paint(SkCanvas* canvas, 54 virtual void Paint(SkCanvas* canvas,
54 const gfx::Rect& content_rect, 55 const gfx::Rect& content_rect,
55 gfx::RectF* opaque) OVERRIDE {} 56 gfx::RectF* opaque) OVERRIDE {}
56 }; 57 };
57 58
58 59
59 class LayerTest : public testing::Test { 60 class LayerTest : public testing::Test {
60 public: 61 public:
61 LayerTest() 62 LayerTest()
62 : host_impl_(&proxy_), 63 : host_impl_(&proxy_, &shared_bitmap_manager_),
63 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} 64 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
64 65
65 protected: 66 protected:
66 virtual void SetUp() OVERRIDE { 67 virtual void SetUp() OVERRIDE {
67 layer_tree_host_.reset(new StrictMock<MockLayerTreeHost>(&fake_client_)); 68 layer_tree_host_.reset(new StrictMock<MockLayerTreeHost>(&fake_client_));
68 } 69 }
69 70
70 virtual void TearDown() OVERRIDE { 71 virtual void TearDown() OVERRIDE {
71 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 72 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
72 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); 73 EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 child1_->AddChild(grand_child1_); 123 child1_->AddChild(grand_child1_);
123 child1_->AddChild(grand_child2_); 124 child1_->AddChild(grand_child2_);
124 child2_->AddChild(grand_child3_); 125 child2_->AddChild(grand_child3_);
125 126
126 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 127 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
127 128
128 VerifyTestTreeInitialState(); 129 VerifyTestTreeInitialState();
129 } 130 }
130 131
131 FakeImplProxy proxy_; 132 FakeImplProxy proxy_;
133 TestSharedBitmapManager shared_bitmap_manager_;
132 FakeLayerTreeHostImpl host_impl_; 134 FakeLayerTreeHostImpl host_impl_;
133 135
134 FakeLayerTreeHostClient fake_client_; 136 FakeLayerTreeHostClient fake_client_;
135 scoped_ptr<StrictMock<MockLayerTreeHost> > layer_tree_host_; 137 scoped_ptr<StrictMock<MockLayerTreeHost> > layer_tree_host_;
136 scoped_refptr<Layer> parent_; 138 scoped_refptr<Layer> parent_;
137 scoped_refptr<Layer> child1_; 139 scoped_refptr<Layer> child1_;
138 scoped_refptr<Layer> child2_; 140 scoped_refptr<Layer> child2_;
139 scoped_refptr<Layer> child3_; 141 scoped_refptr<Layer> child3_;
140 scoped_refptr<Layer> grand_child1_; 142 scoped_refptr<Layer> grand_child1_;
141 scoped_refptr<Layer> grand_child2_; 143 scoped_refptr<Layer> grand_child2_;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 child->SetReplicaLayer(replica_replacement.get()); 799 child->SetReplicaLayer(replica_replacement.get());
798 EXPECT_EQ(NULL, replica->parent()); 800 EXPECT_EQ(NULL, replica->parent());
799 EXPECT_EQ(child, replica_replacement->parent()); 801 EXPECT_EQ(child, replica_replacement->parent());
800 802
801 EXPECT_EQ(replica, replica->mask_layer()->parent()); 803 EXPECT_EQ(replica, replica->mask_layer()->parent());
802 } 804 }
803 805
804 class LayerTreeHostFactory { 806 class LayerTreeHostFactory {
805 public: 807 public:
806 LayerTreeHostFactory() 808 LayerTreeHostFactory()
807 : client_(FakeLayerTreeHostClient::DIRECT_3D) {} 809 : client_(FakeLayerTreeHostClient::DIRECT_3D),
810 shared_bitmap_manager_(new TestSharedBitmapManager()) {}
808 811
809 scoped_ptr<LayerTreeHost> Create() { 812 scoped_ptr<LayerTreeHost> Create() {
810 return LayerTreeHost::CreateSingleThreaded(&client_, 813 return LayerTreeHost::CreateSingleThreaded(&client_,
811 &client_, 814 &client_,
812 NULL, 815 shared_bitmap_manager_.get(),
813 LayerTreeSettings()).Pass(); 816 LayerTreeSettings()).Pass();
814 } 817 }
815 818
816 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { 819 scoped_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
817 return LayerTreeHost::CreateSingleThreaded(&client_, 820 return LayerTreeHost::CreateSingleThreaded(
818 &client_, 821 &client_, &client_, shared_bitmap_manager_.get(), settings)
819 NULL, 822 .Pass();
820 settings).Pass();
821 } 823 }
822 824
823 private: 825 private:
824 FakeLayerTreeHostClient client_; 826 FakeLayerTreeHostClient client_;
827 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
825 }; 828 };
826 829
827 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { 830 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) {
828 EXPECT_EQ(host, layer->layer_tree_host()); 831 EXPECT_EQ(host, layer->layer_tree_host());
829 832
830 for (size_t i = 0; i < layer->children().size(); ++i) 833 for (size_t i = 0; i < layer->children().size(); ++i)
831 AssertLayerTreeHostMatchesForSubtree(layer->children()[i].get(), host); 834 AssertLayerTreeHostMatchesForSubtree(layer->children()[i].get(), host);
832 835
833 if (layer->mask_layer()) 836 if (layer->mask_layer())
834 AssertLayerTreeHostMatchesForSubtree(layer->mask_layer(), host); 837 AssertLayerTreeHostMatchesForSubtree(layer->mask_layer(), host);
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 << "Flags: " << contents_opaque << ", " << layer_opaque << ", " 1079 << "Flags: " << contents_opaque << ", " << layer_opaque << ", "
1077 << host_opaque << "\n"; 1080 << host_opaque << "\n";
1078 } 1081 }
1079 } 1082 }
1080 } 1083 }
1081 } 1084 }
1082 } 1085 }
1083 1086
1084 } // namespace 1087 } // namespace
1085 } // namespace cc 1088 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_position_constraint_unittest.cc ('k') | cc/layers/layer_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698