Index: cc/layers/texture_layer_unittest.cc |
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc |
index 88ff0409615523770fd3c0d49ae6b1b513de8f4b..73c6f7325ca87d278b1c03423138f6ddc4a4fa26 100644 |
--- a/cc/layers/texture_layer_unittest.cc |
+++ b/cc/layers/texture_layer_unittest.cc |
@@ -459,6 +459,33 @@ TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { |
SingleReleaseCallback::Create(test_data_.release_mailbox1_)); |
} |
+TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) { |
+ scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox(NULL); |
+ ASSERT_TRUE(test_layer.get()); |
+ |
+ // These use the same gpu::Mailbox, but different sync points. |
+ TextureMailbox mailbox1(MailboxFromChar('a'), GL_TEXTURE_2D, 1); |
+ TextureMailbox mailbox2(MailboxFromChar('a'), GL_TEXTURE_2D, 2); |
+ |
+ EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
+ EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
+ layer_tree_host_->SetRootLayer(test_layer); |
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
+ |
+ // Set the mailbox the first time. It should cause a commit. |
+ EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
+ EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
+ test_layer->SetTextureMailboxWithoutReleaseCallback(mailbox1); |
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
+ |
+ // Set the mailbox again with a new sync point, as the backing texture has |
+ // been updated. It should cause a new commit. |
+ EXPECT_CALL(*layer_tree_host_, AcquireLayerTextures()).Times(0); |
+ EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AtLeast(1)); |
+ test_layer->SetTextureMailboxWithoutReleaseCallback(mailbox2); |
+ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
+} |
+ |
class TextureLayerMailboxHolderTest : public TextureLayerTest { |
public: |
TextureLayerMailboxHolderTest() |