OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 MOCK_METHOD0(SetNeedsCommit, void()); | 58 MOCK_METHOD0(SetNeedsCommit, void()); |
59 MOCK_METHOD0(SetNeedsUpdateLayers, void()); | 59 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
60 MOCK_METHOD0(StartRateLimiter, void()); | 60 MOCK_METHOD0(StartRateLimiter, void()); |
61 MOCK_METHOD0(StopRateLimiter, void()); | 61 MOCK_METHOD0(StopRateLimiter, void()); |
62 }; | 62 }; |
63 | 63 |
64 class TextureLayerTest : public testing::Test { | 64 class TextureLayerTest : public testing::Test { |
65 public: | 65 public: |
66 TextureLayerTest() | 66 TextureLayerTest() |
67 : fake_client_( | 67 : fake_client_( |
68 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), | 68 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), |
69 host_impl_(&proxy_) {} | 69 host_impl_(&proxy_, &shared_bitmap_manager_) {} |
70 | 70 |
71 protected: | 71 protected: |
72 virtual void SetUp() { | 72 virtual void SetUp() { |
73 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); | 73 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); |
74 } | 74 } |
75 | 75 |
76 virtual void TearDown() { | 76 virtual void TearDown() { |
77 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 77 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
78 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); | 78 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); |
79 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 79 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
80 | 80 |
81 layer_tree_host_->SetRootLayer(NULL); | 81 layer_tree_host_->SetRootLayer(NULL); |
82 layer_tree_host_.reset(); | 82 layer_tree_host_.reset(); |
83 } | 83 } |
84 | 84 |
85 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 85 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
86 FakeImplProxy proxy_; | 86 FakeImplProxy proxy_; |
87 FakeLayerTreeHostClient fake_client_; | 87 FakeLayerTreeHostClient fake_client_; |
| 88 TestSharedBitmapManager shared_bitmap_manager_; |
88 FakeLayerTreeHostImpl host_impl_; | 89 FakeLayerTreeHostImpl host_impl_; |
89 }; | 90 }; |
90 | 91 |
91 TEST_F(TextureLayerTest, SyncImplWhenChangingTextureId) { | 92 TEST_F(TextureLayerTest, SyncImplWhenChangingTextureId) { |
92 scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); | 93 scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); |
93 ASSERT_TRUE(test_layer.get()); | 94 ASSERT_TRUE(test_layer.get()); |
94 | 95 |
95 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); | 96 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AnyNumber()); |
96 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 97 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
97 layer_tree_host_->SetRootLayer(test_layer); | 98 layer_tree_host_->SetRootLayer(test_layer); |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 int callback_count_; | 2192 int callback_count_; |
2192 scoped_refptr<Layer> root_; | 2193 scoped_refptr<Layer> root_; |
2193 scoped_refptr<TextureLayer> layer_; | 2194 scoped_refptr<TextureLayer> layer_; |
2194 }; | 2195 }; |
2195 | 2196 |
2196 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 2197 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
2197 TextureLayerWithMailboxImplThreadDeleted); | 2198 TextureLayerWithMailboxImplThreadDeleted); |
2198 | 2199 |
2199 } // namespace | 2200 } // namespace |
2200 } // namespace cc | 2201 } // namespace cc |
OLD | NEW |