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

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

Issue 22824009: Remove StreamTextureManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 7 years, 4 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 | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_manager_unittest.cc
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index 402cc8d0eff7b1394e8794b36d9b483eef7393aa..b9baf0e6a42be4aa973fbaf4a6464021f9a2e4cf 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -469,8 +469,23 @@ TEST_F(TextureTest, SetTargetTextureExternalOES) {
EXPECT_FALSE(manager_->CanRender(texture_ref_.get()));
EXPECT_TRUE(texture->SafeToRenderFrom());
EXPECT_TRUE(texture->IsImmutable());
- manager_->SetStreamTexture(texture_ref_.get(), true);
+ manager_->SetLevelInfo(texture_ref_.get(),
+ GL_TEXTURE_EXTERNAL_OES,
+ 0,
+ GL_RGBA,
+ 0,
+ 0,
+ 1,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ true);
+ manager_->SetLevelImage(texture_ref_.get(),
+ GL_TEXTURE_EXTERNAL_OES,
+ 0,
+ gfx::GLImage::CreateGLImage(0).get());
EXPECT_TRUE(manager_->CanRender(texture_ref_.get()));
+ EXPECT_TRUE(texture->IsImmutable());
}
TEST_F(TextureTest, ZeroSizeCanNotRender) {
@@ -1807,7 +1822,8 @@ TEST_F(TextureTest, AddToSignature) {
EXPECT_EQ(11u, string_set.size());
}
-class ProduceConsumeTextureTest : public TextureTest {
+class ProduceConsumeTextureTest : public TextureTest,
+ public ::testing::WithParamInterface<GLenum> {
public:
virtual void SetUp() {
TextureTest::SetUpBase(NULL, "GL_OES_EGL_image_external");
@@ -2002,25 +2018,49 @@ TEST_F(ProduceConsumeTextureTest, ProduceConsumeClearRectangle) {
decoder_.get(), restored_texture.get(), GL_TEXTURE_RECTANGLE_ARB, 0));
}
-TEST_F(ProduceConsumeTextureTest, ProduceConsumeStreamTexture) {
- manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_EXTERNAL_OES);
+TEST_P(ProduceConsumeTextureTest, ProduceConsumeTextureWithImage) {
+ GLenum target = GetParam();
+ manager_->SetTarget(texture_ref_.get(), target);
Texture* texture = texture_ref_->texture();
- EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture->target());
- manager_->SetStreamTexture(texture_ref_.get(), true);
+ EXPECT_EQ(static_cast<GLenum>(target), texture->target());
+ scoped_refptr<gfx::GLImage> image(gfx::GLImage::CreateGLImage(0));
+ manager_->SetLevelInfo(texture_ref_.get(),
+ target,
+ 0,
+ GL_RGBA,
+ 0,
+ 0,
+ 1,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ true);
+ manager_->SetLevelImage(texture_ref_.get(),
+ target,
+ 0,
+ image);
GLuint service_id = texture->service_id();
Texture* produced_texture = Produce(texture_ref_.get());
- EXPECT_TRUE(texture->IsStreamTexture());
GLuint client_id = texture2_->client_id();
manager_->RemoveTexture(client_id);
Consume(client_id, produced_texture);
scoped_refptr<TextureRef> restored_texture = manager_->GetTexture(client_id);
EXPECT_EQ(produced_texture, restored_texture->texture());
- EXPECT_TRUE(restored_texture->texture()->IsStreamTexture());
- EXPECT_TRUE(restored_texture->texture()->IsImmutable());
EXPECT_EQ(service_id, restored_texture->service_id());
+ EXPECT_EQ(image.get(), restored_texture->texture()->GetLevelImage(target, 0));
}
+static const GLenum kTextureTargets[] = {
+ GL_TEXTURE_2D,
+ GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_RECTANGLE_ARB,
+};
+
+INSTANTIATE_TEST_CASE_P(Target,
+ ProduceConsumeTextureTest,
+ ::testing::ValuesIn(kTextureTargets));
+
TEST_F(ProduceConsumeTextureTest, ProduceConsumeCube) {
manager_->SetTarget(texture_ref_.get(), GL_TEXTURE_CUBE_MAP);
Texture* texture = texture_ref_->texture();
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698