| 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/base/thread.h" | 10 #include "cc/base/thread.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 Release(test_data_.mailbox_name1_, | 227 Release(test_data_.mailbox_name1_, |
| 228 test_data_.sync_point1_, | 228 test_data_.sync_point1_, |
| 229 false)).Times(1); | 229 false)).Times(1); |
| 230 TextureLayerTest::TearDown(); | 230 TextureLayerTest::TearDown(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 CommonMailboxObjects test_data_; | 233 CommonMailboxObjects test_data_; |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { | 236 TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { |
| 237 scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(); | 237 scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); |
| 238 ASSERT_TRUE(test_layer); | 238 ASSERT_TRUE(test_layer); |
| 239 | 239 |
| 240 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); | 240 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
| 241 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 241 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 242 layer_tree_host_->SetRootLayer(test_layer); | 242 layer_tree_host_->SetRootLayer(test_layer); |
| 243 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 243 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 244 | 244 |
| 245 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); | 245 EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
| 246 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); | 246 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
| 247 test_layer->SetTextureMailbox(test_data_.mailbox1_); | 247 test_layer->SetTextureMailbox(test_data_.mailbox1_); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 base::Unretained(this))); | 295 base::Unretained(this))); |
| 296 layer_->SetTextureMailbox(mailbox); | 296 layer_->SetTextureMailbox(mailbox); |
| 297 } | 297 } |
| 298 | 298 |
| 299 virtual void BeginTest() OVERRIDE { | 299 virtual void BeginTest() OVERRIDE { |
| 300 gfx::Size bounds(100, 100); | 300 gfx::Size bounds(100, 100); |
| 301 root_ = Layer::Create(); | 301 root_ = Layer::Create(); |
| 302 root_->SetAnchorPoint(gfx::PointF()); | 302 root_->SetAnchorPoint(gfx::PointF()); |
| 303 root_->SetBounds(bounds); | 303 root_->SetBounds(bounds); |
| 304 | 304 |
| 305 layer_ = TextureLayer::CreateForMailbox(); | 305 layer_ = TextureLayer::CreateForMailbox(NULL); |
| 306 layer_->SetIsDrawable(true); | 306 layer_->SetIsDrawable(true); |
| 307 layer_->SetAnchorPoint(gfx::PointF()); | 307 layer_->SetAnchorPoint(gfx::PointF()); |
| 308 layer_->SetBounds(bounds); | 308 layer_->SetBounds(bounds); |
| 309 | 309 |
| 310 root_->AddChild(layer_); | 310 root_->AddChild(layer_); |
| 311 layer_tree_host()->SetRootLayer(root_); | 311 layer_tree_host()->SetRootLayer(root_); |
| 312 layer_tree_host()->SetViewportSize(bounds); | 312 layer_tree_host()->SetViewportSize(bounds); |
| 313 SetMailbox('1'); | 313 SetMailbox('1'); |
| 314 EXPECT_EQ(0, callback_count_); | 314 EXPECT_EQ(0, callback_count_); |
| 315 | 315 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 514 } |
| 515 | 515 |
| 516 virtual unsigned PrepareTexture(ResourceUpdateQueue* queue) OVERRIDE { | 516 virtual unsigned PrepareTexture(ResourceUpdateQueue* queue) OVERRIDE { |
| 517 return texture_; | 517 return texture_; |
| 518 } | 518 } |
| 519 | 519 |
| 520 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE { | 520 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE { |
| 521 return context_; | 521 return context_; |
| 522 } | 522 } |
| 523 | 523 |
| 524 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox) OVERRIDE { |
| 525 return false; |
| 526 } |
| 527 |
| 524 virtual void SetupTree() OVERRIDE { | 528 virtual void SetupTree() OVERRIDE { |
| 525 scoped_refptr<Layer> root = Layer::Create(); | 529 scoped_refptr<Layer> root = Layer::Create(); |
| 526 root->SetBounds(gfx::Size(10, 10)); | 530 root->SetBounds(gfx::Size(10, 10)); |
| 527 root->SetAnchorPoint(gfx::PointF()); | 531 root->SetAnchorPoint(gfx::PointF()); |
| 528 root->SetIsDrawable(true); | 532 root->SetIsDrawable(true); |
| 529 | 533 |
| 530 texture_layer_ = TextureLayer::Create(this); | 534 texture_layer_ = TextureLayer::Create(this); |
| 531 texture_layer_->SetBounds(gfx::Size(10, 10)); | 535 texture_layer_->SetBounds(gfx::Size(10, 10)); |
| 532 texture_layer_->SetAnchorPoint(gfx::PointF()); | 536 texture_layer_->SetAnchorPoint(gfx::PointF()); |
| 533 texture_layer_->SetIsDrawable(true); | 537 texture_layer_->SetIsDrawable(true); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 601 |
| 598 // Used on either thread, protected by lock_. | 602 // Used on either thread, protected by lock_. |
| 599 base::Lock lock_; | 603 base::Lock lock_; |
| 600 unsigned expected_used_textures_on_commit_; | 604 unsigned expected_used_textures_on_commit_; |
| 601 }; | 605 }; |
| 602 | 606 |
| 603 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerClientTest); | 607 SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerClientTest); |
| 604 | 608 |
| 605 } // namespace | 609 } // namespace |
| 606 } // namespace cc | 610 } // namespace cc |
| OLD | NEW |