Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Unified Diff: cc/layers/texture_layer_unittest.cc

Issue 189333003: cc: Allow pepper to avoid DCHECK but reuse gpu::Mailbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: baddcheck: compile Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « cc/layers/texture_layer.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698