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 "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 187 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
188 | 188 |
189 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AtLeast(1)); | 189 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(AtLeast(1)); |
190 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 190 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
191 test_layer->RemoveFromParent(); | 191 test_layer->RemoveFromParent(); |
192 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 192 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
193 } | 193 } |
194 | 194 |
195 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 195 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
196 scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); | 196 scoped_refptr<TextureLayer> test_layer = TextureLayer::Create(NULL); |
197 layer_tree_host_->SetRootLayer(test_layer); | 197 EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); |
198 | 198 |
199 // Test properties that should call SetNeedsCommit. All properties need to | 199 // Test properties that should call SetNeedsCommit. All properties need to |
200 // be set to new values in order for SetNeedsCommit to be called. | 200 // be set to new values in order for SetNeedsCommit to be called. |
201 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFlipped(false)); | 201 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFlipped(false)); |
202 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUV( | 202 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUV( |
203 gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f))); | 203 gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f))); |
204 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetVertexOpacity( | 204 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetVertexOpacity( |
205 0.5f, 0.5f, 0.5f, 0.5f)); | 205 0.5f, 0.5f, 0.5f, 0.5f)); |
206 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPremultipliedAlpha(false)); | 206 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetPremultipliedAlpha(false)); |
207 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendBackgroundColor(true)); | 207 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetBlendBackgroundColor(true)); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 413 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
414 EXPECT_CALL(test_data_.mock_callback_, | 414 EXPECT_CALL(test_data_.mock_callback_, |
415 Release(test_data_.mailbox_name2_, | 415 Release(test_data_.mailbox_name2_, |
416 test_data_.sync_point2_, | 416 test_data_.sync_point2_, |
417 false)) | 417 false)) |
418 .Times(1); | 418 .Times(1); |
419 test_layer->SetTextureMailbox(TextureMailbox()); | 419 test_layer->SetTextureMailbox(TextureMailbox()); |
420 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 420 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
421 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); | 421 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); |
422 | 422 |
| 423 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
| 424 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
423 test_layer->SetTextureMailbox(test_data_.mailbox3_); | 425 test_layer->SetTextureMailbox(test_data_.mailbox3_); |
424 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 426 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
425 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); | 427 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); |
426 | 428 |
427 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); | 429 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
428 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 430 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
429 EXPECT_CALL(test_data_.mock_callback_, | 431 EXPECT_CALL(test_data_.mock_callback_, |
430 Release2(test_data_.shared_memory_.get(), | 432 Release2(test_data_.shared_memory_.get(), |
431 0, false)) | 433 0, false)) |
432 .Times(1); | 434 .Times(1); |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 int callback_count_; | 1674 int callback_count_; |
1673 scoped_refptr<Layer> root_; | 1675 scoped_refptr<Layer> root_; |
1674 scoped_refptr<TextureLayer> layer_; | 1676 scoped_refptr<TextureLayer> layer_; |
1675 }; | 1677 }; |
1676 | 1678 |
1677 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1679 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1678 TextureLayerWithMailboxImplThreadDeleted); | 1680 TextureLayerWithMailboxImplThreadDeleted); |
1679 | 1681 |
1680 } // namespace | 1682 } // namespace |
1681 } // namespace cc | 1683 } // namespace cc |
OLD | NEW |