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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_attribs.cc

Issue 2043983002: gpu: Disallow null client ids in Gen* functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_unittest_1_autogen.h ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 GenVertexArraysOESImmediate* cmd = 261 GenVertexArraysOESImmediate* cmd =
262 GetImmediateAs<GenVertexArraysOESImmediate>(); 262 GetImmediateAs<GenVertexArraysOESImmediate>();
263 GLuint temp = kNewClientId; 263 GLuint temp = kNewClientId;
264 cmd->Init(1, &temp); 264 cmd->Init(1, &temp);
265 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); 265 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
266 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 266 EXPECT_EQ(GL_NO_ERROR, GetGLError());
267 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL); 267 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) != NULL);
268 AddExpectationsForDeleteVertexArraysOES(); 268 AddExpectationsForDeleteVertexArraysOES();
269 } 269 }
270 270
271 void GenVertexArraysOESImmediateDuplicateIds() { 271 void GenVertexArraysOESImmediateDuplicateOrNullIds() {
272 cmds::GenVertexArraysOESImmediate* cmd = 272 cmds::GenVertexArraysOESImmediate* cmd =
273 GetImmediateAs<cmds::GenVertexArraysOESImmediate>(); 273 GetImmediateAs<cmds::GenVertexArraysOESImmediate>();
274 GLuint temp[3] = {kNewClientId, kNewClientId + 1, kNewClientId}; 274 GLuint temp[3] = {kNewClientId, kNewClientId + 1, kNewClientId};
275 cmd->Init(3, temp); 275 cmd->Init(3, temp);
276 EXPECT_EQ(error::kInvalidArguments, 276 EXPECT_EQ(error::kInvalidArguments,
277 ExecuteImmediateCmd(*cmd, sizeof(temp))); 277 ExecuteImmediateCmd(*cmd, sizeof(temp)));
278 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) == NULL); 278 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) == NULL);
279 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId + 1) == NULL); 279 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId + 1) == NULL);
280 GLuint null_id[2] = {kNewClientId, 0};
281 cmd->Init(2, null_id);
282 EXPECT_EQ(error::kInvalidArguments,
283 ExecuteImmediateCmd(*cmd, sizeof(temp)));
284 EXPECT_TRUE(GetVertexArrayInfo(kNewClientId) == NULL);
280 } 285 }
281 286
282 void GenVertexArraysOESImmediateInvalidArgs() { 287 void GenVertexArraysOESImmediateInvalidArgs() {
283 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0); 288 EXPECT_CALL(*gl_, GenVertexArraysOES(_, _)).Times(0);
284 GenVertexArraysOESImmediate* cmd = 289 GenVertexArraysOESImmediate* cmd =
285 GetImmediateAs<GenVertexArraysOESImmediate>(); 290 GetImmediateAs<GenVertexArraysOESImmediate>();
286 cmd->Init(1, &client_vertexarray_id_); 291 cmd->Init(1, &client_vertexarray_id_);
287 EXPECT_EQ(error::kInvalidArguments, 292 EXPECT_EQ(error::kInvalidArguments,
288 ExecuteImmediateCmd(*cmd, sizeof(&client_vertexarray_id_))); 293 ExecuteImmediateCmd(*cmd, sizeof(&client_vertexarray_id_)));
289 } 294 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // Test vertex array objects with native support 390 // Test vertex array objects with native support
386 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESImmediateValidArgs) { 391 TEST_P(GLES2DecoderVertexArraysOESTest, GenVertexArraysOESImmediateValidArgs) {
387 GenVertexArraysOESImmediateValidArgs(); 392 GenVertexArraysOESImmediateValidArgs();
388 } 393 }
389 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, 394 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest,
390 GenVertexArraysOESImmediateValidArgs) { 395 GenVertexArraysOESImmediateValidArgs) {
391 GenVertexArraysOESImmediateValidArgs(); 396 GenVertexArraysOESImmediateValidArgs();
392 } 397 }
393 398
394 TEST_P(GLES2DecoderVertexArraysOESTest, 399 TEST_P(GLES2DecoderVertexArraysOESTest,
395 GenVertexArraysOESImmediateDuplicateIds) { 400 GenVertexArraysOESImmediateDuplicateOrNullIds) {
396 GenVertexArraysOESImmediateDuplicateIds(); 401 GenVertexArraysOESImmediateDuplicateOrNullIds();
397 } 402 }
398 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, 403 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest,
399 GenVertexArraysOESImmediateDuplicateIds) { 404 GenVertexArraysOESImmediateDuplicateOrNullIds) {
400 GenVertexArraysOESImmediateDuplicateIds(); 405 GenVertexArraysOESImmediateDuplicateOrNullIds();
401 } 406 }
402 407
403 TEST_P(GLES2DecoderVertexArraysOESTest, 408 TEST_P(GLES2DecoderVertexArraysOESTest,
404 GenVertexArraysOESImmediateInvalidArgs) { 409 GenVertexArraysOESImmediateInvalidArgs) {
405 GenVertexArraysOESImmediateInvalidArgs(); 410 GenVertexArraysOESImmediateInvalidArgs();
406 } 411 }
407 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest, 412 TEST_P(GLES2DecoderEmulatedVertexArraysOESTest,
408 GenVertexArraysOESImmediateInvalidArgs) { 413 GenVertexArraysOESImmediateInvalidArgs) {
409 GenVertexArraysOESImmediateInvalidArgs(); 414 GenVertexArraysOESImmediateInvalidArgs();
410 } 415 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // TODO(gman): BufferData 497 // TODO(gman): BufferData
493 498
494 // TODO(gman): BufferDataImmediate 499 // TODO(gman): BufferDataImmediate
495 500
496 // TODO(gman): BufferSubData 501 // TODO(gman): BufferSubData
497 502
498 // TODO(gman): BufferSubDataImmediate 503 // TODO(gman): BufferSubDataImmediate
499 504
500 } // namespace gles2 505 } // namespace gles2
501 } // namespace gpu 506 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698