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 cd627805faa67cd48fe4a45257bd74c344c199bf..b8785b6a3db74c198f63abafafe9051bb11d9162 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
@@ -5971,20 +5971,18 @@ TEST_F(GLES2DecoderManualInitTest, ProduceAndConsumeStreamTextureCHROMIUM) { |
EXPECT_EQ(kServiceTextureId, texture_ref->service_id()); |
- // Assigns and binds new service side texture ID. |
- EXPECT_CALL(*gl_, GenTextures(1, _)) |
- .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- |
ProduceTextureCHROMIUM produce_cmd; |
produce_cmd.Init( |
GL_TEXTURE_EXTERNAL_OES, kSharedMemoryId, kSharedMemoryOffset); |
EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
+ // Create new texture for consume. |
+ EXPECT_CALL(*gl_, GenTextures(_, _)) |
+ .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
+ .RetiresOnSaturation(); |
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, kNewClientId, kNewServiceId); |
+ |
// Assigns and binds original service size texture ID. |
EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
.Times(1) |
@@ -5993,30 +5991,6 @@ TEST_F(GLES2DecoderManualInitTest, ProduceAndConsumeStreamTextureCHROMIUM) { |
.Times(1) |
.RetiresOnSaturation(); |
- // TextureManager::Restore will set TexParameters. |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- #if 0 |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- #endif |
- |
// Shared mem got clobbered from GetError() above. |
memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
ConsumeTextureCHROMIUM consume_cmd; |
@@ -7405,40 +7379,39 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { |
Texture* texture = texture_ref->texture(); |
EXPECT_EQ(kServiceTextureId, texture->service_id()); |
- // Assigns and binds new service side texture ID. |
- EXPECT_CALL(*gl_, GenTextures(1, _)) |
- .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- |
ProduceTextureCHROMIUM produce_cmd; |
produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
+ EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
- // Texture is zero-by-zero. |
+ // Texture didn't change. |
GLsizei width; |
GLsizei height; |
GLenum type; |
GLenum internal_format; |
EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
- EXPECT_EQ(0, width); |
- EXPECT_EQ(0, height); |
+ EXPECT_EQ(3, width); |
+ EXPECT_EQ(1, height); |
EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); |
- EXPECT_EQ(0, width); |
- EXPECT_EQ(0, height); |
+ EXPECT_EQ(2, width); |
+ EXPECT_EQ(4, height); |
EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); |
EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
- // Service ID has changed. |
- EXPECT_EQ(kNewServiceId, texture->service_id()); |
+ // Service ID has not changed. |
+ EXPECT_EQ(kServiceTextureId, texture->service_id()); |
+ |
+ // Create new texture for consume. |
+ EXPECT_CALL(*gl_, GenTextures(_, _)) |
+ .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
+ .RetiresOnSaturation(); |
+ DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId); |
// Assigns and binds original service size texture ID. |
EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
@@ -7448,33 +7421,11 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { |
.Times(1) |
.RetiresOnSaturation(); |
- // TextureManager::Restore will set TexParameters. |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- #if 0 |
- EXPECT_CALL(*gl_, TexParameteri( |
- GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE)) |
- .Times(1) |
- .RetiresOnSaturation(); |
- #endif |
- |
+ memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); |
ConsumeTextureCHROMIUM consume_cmd; |
consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); |
+ EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
// Texture is redefined. |
EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |