OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file defines tests that implementations of GLImage should pass in order | 5 // This file defines tests that implementations of GLImage should pass in order |
6 // to be conformant. | 6 // to be conformant. |
7 | 7 |
8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // GLImage in order to be conformant. | 162 // GLImage in order to be conformant. |
163 REGISTER_TYPED_TEST_CASE_P(GLImageTest, CreateAndDestroy); | 163 REGISTER_TYPED_TEST_CASE_P(GLImageTest, CreateAndDestroy); |
164 | 164 |
165 template <typename GLImageTestDelegate> | 165 template <typename GLImageTestDelegate> |
166 class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {}; | 166 class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {}; |
167 | 167 |
168 // This test verifies that if an uninitialized image is bound to a texture, the | 168 // This test verifies that if an uninitialized image is bound to a texture, the |
169 // result is zero-initialized. | 169 // result is zero-initialized. |
170 TYPED_TEST_CASE_P(GLImageZeroInitializeTest); | 170 TYPED_TEST_CASE_P(GLImageZeroInitializeTest); |
171 | 171 |
172 // TODO(erikchen): Enable this test when it actually passes on Mac. | 172 TYPED_TEST_P(GLImageZeroInitializeTest, ZeroInitialize) { |
173 // https://crbug.com/584760. | |
174 TYPED_TEST_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize) { | |
175 const gfx::Size image_size(256, 256); | 173 const gfx::Size image_size(256, 256); |
176 scoped_refptr<gl::GLImage> image = this->delegate_.CreateImage(image_size); | 174 scoped_refptr<gl::GLImage> image = this->delegate_.CreateImage(image_size); |
177 GLenum target = this->delegate_.GetTextureTarget(); | 175 GLenum target = this->delegate_.GetTextureTarget(); |
178 GLuint uninitialized_texture = GLTestHelper::CreateTexture(target); | 176 GLuint uninitialized_texture = GLTestHelper::CreateTexture(target); |
179 | 177 |
180 glBindTexture(target, uninitialized_texture); | 178 glBindTexture(target, uninitialized_texture); |
181 ASSERT_TRUE(image->BindTexImage(target)); | 179 ASSERT_TRUE(image->BindTexImage(target)); |
182 GLuint framebuffer = | 180 GLuint framebuffer = |
183 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height()); | 181 GLTestHelper::SetupFramebuffer(image_size.width(), image_size.height()); |
184 ASSERT_TRUE(framebuffer); | 182 ASSERT_TRUE(framebuffer); |
(...skipping 13 matching lines...) Expand all Loading... |
198 glDeleteShader(pas.vertex_shader); | 196 glDeleteShader(pas.vertex_shader); |
199 glDeleteShader(pas.fragment_shader); | 197 glDeleteShader(pas.fragment_shader); |
200 glDeleteBuffersARB(1, &vertex_buffer); | 198 glDeleteBuffersARB(1, &vertex_buffer); |
201 glDeleteFramebuffersEXT(1, &framebuffer); | 199 glDeleteFramebuffersEXT(1, &framebuffer); |
202 | 200 |
203 image->ReleaseTexImage(target); | 201 image->ReleaseTexImage(target); |
204 image->Destroy(true); | 202 image->Destroy(true); |
205 glDeleteTextures(1, &uninitialized_texture); | 203 glDeleteTextures(1, &uninitialized_texture); |
206 } | 204 } |
207 | 205 |
208 REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize); | 206 REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, ZeroInitialize); |
209 | 207 |
210 template <typename GLImageTestDelegate> | 208 template <typename GLImageTestDelegate> |
211 class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {}; | 209 class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {}; |
212 | 210 |
213 TYPED_TEST_CASE_P(GLImageCopyTest); | 211 TYPED_TEST_CASE_P(GLImageCopyTest); |
214 | 212 |
215 TYPED_TEST_P(GLImageCopyTest, CopyTexImage) { | 213 TYPED_TEST_P(GLImageCopyTest, CopyTexImage) { |
216 const gfx::Size image_size(256, 256); | 214 const gfx::Size image_size(256, 256); |
217 // These values are picked so that RGB -> YUV on the CPU converted | 215 // These values are picked so that RGB -> YUV on the CPU converted |
218 // back to RGB on the GPU produces the original RGB values without | 216 // back to RGB on the GPU produces the original RGB values without |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 image->Destroy(true); | 269 image->Destroy(true); |
272 } | 270 } |
273 | 271 |
274 // The GLImageCopyTest test case verifies that the GLImage implementation | 272 // The GLImageCopyTest test case verifies that the GLImage implementation |
275 // handles CopyTexImage correctly. | 273 // handles CopyTexImage correctly. |
276 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); | 274 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); |
277 | 275 |
278 } // namespace gl | 276 } // namespace gl |
279 | 277 |
280 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 278 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
OLD | NEW |