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

Side by Side Diff: gpu/command_buffer/tests/gl_compressed_copy_texture_CHROMIUM_unittest.cc

Issue 2094343003: CompressedCopyTextureCHROMIUM: validate texture targets before looking up levels (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 glCompressedCopyTextureCHROMIUM(99994, textures_[1]); 268 glCompressedCopyTextureCHROMIUM(99994, textures_[1]);
269 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); 269 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE);
270 270
271 glCompressedCopyTextureCHROMIUM(99995, 99996); 271 glCompressedCopyTextureCHROMIUM(99995, 99996);
272 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE); 272 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE);
273 273
274 glCompressedCopyTextureCHROMIUM(textures_[0], textures_[1]); 274 glCompressedCopyTextureCHROMIUM(textures_[0], textures_[1]);
275 EXPECT_TRUE(glGetError() == GL_NO_ERROR); 275 EXPECT_TRUE(glGetError() == GL_NO_ERROR);
276 } 276 }
277 277
278 TEST_F(GLCompressedCopyTextureCHROMIUMTest, InvalidTextureTarget) {
279 glBindTexture(GL_TEXTURE_CUBE_MAP, textures_[0]);
280 glBindTexture(GL_TEXTURE_CUBE_MAP, textures_[1]);
281 glCompressedCopyTextureCHROMIUM(textures_[0], textures_[1]);
282 EXPECT_TRUE(glGetError() == GL_INVALID_VALUE);
283 }
284
278 // Validate that some basic GL state is not touched upon execution of 285 // Validate that some basic GL state is not touched upon execution of
279 // the extension. 286 // the extension.
280 TEST_F(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) { 287 TEST_F(GLCompressedCopyTextureCHROMIUMTest, BasicStatePreservation) {
281 if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) { 288 if (!GLTestHelper::HasExtension("GL_EXT_texture_compression_dxt1")) {
282 LOG(INFO) << 289 LOG(INFO) <<
283 "GL_EXT_texture_compression_dxt1 not supported. Skipping test..."; 290 "GL_EXT_texture_compression_dxt1 not supported. Skipping test...";
284 return; 291 return;
285 } 292 }
286 293
287 glBindTexture(GL_TEXTURE_2D, textures_[0]); 294 glBindTexture(GL_TEXTURE_2D, textures_[0]);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture); 398 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_texture);
392 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture)); 399 EXPECT_EQ(texture_ids[0], static_cast<GLuint>(bound_texture));
393 glBindTexture(GL_TEXTURE_2D, 0); 400 glBindTexture(GL_TEXTURE_2D, 0);
394 401
395 glDeleteTextures(2, texture_ids); 402 glDeleteTextures(2, texture_ids);
396 403
397 EXPECT_TRUE(GL_NO_ERROR == glGetError()); 404 EXPECT_TRUE(GL_NO_ERROR == glGetError());
398 } 405 }
399 406
400 } // namespace gpu 407 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698