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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 8676048: Add unit test to verify a texture can be reused with stream textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 25d96c71b4d72312cdbe8984e748f7e779527c27..17234b90b543ab1ce8f817dd4fe0a53c684a573b 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -4874,6 +4874,55 @@ TEST_F(GLES2DecoderManualInitTest, StreamTextureCHROMIUMNullMgr) {
GetGLError(); // ignore internal error
}
+TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) {
+ const GLuint kObjectId = 123;
+ InitDecoder(
+ "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
+
+ StrictMock<MockStreamTextureManager> manager;
+ StrictMock<MockStreamTexture> texture;
+ decoder_->SetStreamTextureManager(&manager);
+
+ EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId))
+ .WillOnce(Return(&texture))
+ .RetiresOnSaturation();
+ EXPECT_CALL(texture, Update())
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(manager, DestroyStreamTexture(kServiceTextureId))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(manager, CreateStreamTexture(kServiceTextureId,
+ client_texture_id_))
+ .WillOnce(Return(kObjectId))
+ .RetiresOnSaturation();
+
+ TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
+ info->SetStreamTexture(true);
+
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ DestroyStreamTextureCHROMIUM cmd;
+ cmd.Init(client_texture_id_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_FALSE(info->IsStreamTexture());
+
+ CreateStreamTextureCHROMIUM cmd2;
+ cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_TRUE(info->IsStreamTexture());
+}
+
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
InitDecoder(
"GL_ARB_texture_rectangle", // extensions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698