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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "cc/layers/texture_layer_client.h" | 10 #include "cc/layers/texture_layer_client.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class MockLayerTreeHost : public LayerTreeHost { | 32 class MockLayerTreeHost : public LayerTreeHost { |
33 public: | 33 public: |
34 explicit MockLayerTreeHost(LayerTreeHostClient* client) | 34 explicit MockLayerTreeHost(LayerTreeHostClient* client) |
35 : LayerTreeHost(client, LayerTreeSettings()) { | 35 : LayerTreeHost(client, LayerTreeSettings()) { |
36 Initialize(NULL); | 36 Initialize(NULL); |
37 } | 37 } |
38 | 38 |
39 MOCK_METHOD0(AcquireLayerTextures, void()); | 39 MOCK_METHOD0(AcquireLayerTextures, void()); |
40 MOCK_METHOD0(SetNeedsCommit, void()); | 40 MOCK_METHOD0(SetNeedsCommit, void()); |
| 41 MOCK_METHOD0(SetNeedsUpdateLayers, void()); |
41 MOCK_METHOD1(StartRateLimiter, void(WebKit::WebGraphicsContext3D* context)); | 42 MOCK_METHOD1(StartRateLimiter, void(WebKit::WebGraphicsContext3D* context)); |
42 MOCK_METHOD1(StopRateLimiter, void(WebKit::WebGraphicsContext3D* context)); | 43 MOCK_METHOD1(StopRateLimiter, void(WebKit::WebGraphicsContext3D* context)); |
43 }; | 44 }; |
44 | 45 |
45 class TextureLayerTest : public testing::Test { | 46 class TextureLayerTest : public testing::Test { |
46 public: | 47 public: |
47 TextureLayerTest() | 48 TextureLayerTest() |
48 : fake_client_( | 49 : fake_client_( |
49 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), | 50 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), |
50 host_impl_(&proxy_) {} | 51 host_impl_(&proxy_) {} |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 test_layer->SetIsDrawable(true); | 112 test_layer->SetIsDrawable(true); |
112 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 113 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
113 EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); | 114 EXPECT_EQ(test_layer->layer_tree_host(), layer_tree_host_.get()); |
114 | 115 |
115 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(1); | 116 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(1); |
116 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); | 117 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); |
117 test_layer->WillModifyTexture(); | 118 test_layer->WillModifyTexture(); |
118 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 119 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
119 | 120 |
120 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); | 121 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
121 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 122 EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(1); |
122 test_layer->SetNeedsDisplayRect(dirty_rect); | 123 test_layer->SetNeedsDisplayRect(dirty_rect); |
123 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 124 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
124 | 125 |
125 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); | 126 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
126 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); | 127 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1); |
127 test_layer->PushPropertiesTo(impl_layer.get()); // fake commit | 128 test_layer->PushPropertiesTo(impl_layer.get()); // fake commit |
128 test_layer->SetIsDrawable(false); | 129 test_layer->SetIsDrawable(false); |
129 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 130 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
130 | 131 |
131 // Verify that non-drawable layers don't signal the compositor, | 132 // Verify that non-drawable layers don't signal the compositor, |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 int callback_count_; | 1083 int callback_count_; |
1083 scoped_refptr<Layer> root_; | 1084 scoped_refptr<Layer> root_; |
1084 scoped_refptr<TextureLayer> layer_; | 1085 scoped_refptr<TextureLayer> layer_; |
1085 }; | 1086 }; |
1086 | 1087 |
1087 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1088 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1088 TextureLayerWithMailboxImplThreadDeleted); | 1089 TextureLayerWithMailboxImplThreadDeleted); |
1089 | 1090 |
1090 } // namespace | 1091 } // namespace |
1091 } // namespace cc | 1092 } // namespace cc |
OLD | NEW |