Handle account removal correctly on all platforms.
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_unittest_autogen.h
blobba27559a8d9d08778a1447ccd3b49bed0f343fc1
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
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file is included by gles2_implementation.h to declare the
12 // GL api functions.
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
16 TEST_F(GLES2ImplementationTest, AttachShader) {
17 struct Cmds {
18 cmds::AttachShader cmd;
20 Cmds expected;
21 expected.cmd.Init(1, 2);
23 gl_->AttachShader(1, 2);
24 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
26 // TODO: Implement unit test for BindAttribLocation
28 TEST_F(GLES2ImplementationTest, BindBuffer) {
29 struct Cmds {
30 cmds::BindBuffer cmd;
32 Cmds expected;
33 expected.cmd.Init(GL_ARRAY_BUFFER, 2);
35 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
36 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
37 ClearCommands();
38 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
39 EXPECT_TRUE(NoCommandsWritten());
42 TEST_F(GLES2ImplementationTest, BindFramebuffer) {
43 struct Cmds {
44 cmds::BindFramebuffer cmd;
46 Cmds expected;
47 expected.cmd.Init(GL_FRAMEBUFFER, 2);
49 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
50 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
51 ClearCommands();
52 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
53 EXPECT_TRUE(NoCommandsWritten());
56 TEST_F(GLES2ImplementationTest, BindRenderbuffer) {
57 struct Cmds {
58 cmds::BindRenderbuffer cmd;
60 Cmds expected;
61 expected.cmd.Init(GL_RENDERBUFFER, 2);
63 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
64 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
65 ClearCommands();
66 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
67 EXPECT_TRUE(NoCommandsWritten());
70 TEST_F(GLES2ImplementationTest, BlendColor) {
71 struct Cmds {
72 cmds::BlendColor cmd;
74 Cmds expected;
75 expected.cmd.Init(1, 2, 3, 4);
77 gl_->BlendColor(1, 2, 3, 4);
78 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
81 TEST_F(GLES2ImplementationTest, BlendEquation) {
82 struct Cmds {
83 cmds::BlendEquation cmd;
85 Cmds expected;
86 expected.cmd.Init(GL_FUNC_SUBTRACT);
88 gl_->BlendEquation(GL_FUNC_SUBTRACT);
89 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
92 TEST_F(GLES2ImplementationTest, BlendEquationSeparate) {
93 struct Cmds {
94 cmds::BlendEquationSeparate cmd;
96 Cmds expected;
97 expected.cmd.Init(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
99 gl_->BlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
100 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
103 TEST_F(GLES2ImplementationTest, BlendFunc) {
104 struct Cmds {
105 cmds::BlendFunc cmd;
107 Cmds expected;
108 expected.cmd.Init(GL_ZERO, GL_ZERO);
110 gl_->BlendFunc(GL_ZERO, GL_ZERO);
111 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
114 TEST_F(GLES2ImplementationTest, BlendFuncSeparate) {
115 struct Cmds {
116 cmds::BlendFuncSeparate cmd;
118 Cmds expected;
119 expected.cmd.Init(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
121 gl_->BlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
122 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
125 TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) {
126 struct Cmds {
127 cmds::CheckFramebufferStatus cmd;
130 Cmds expected;
131 ExpectedMemoryInfo result1 =
132 GetExpectedResultMemory(sizeof(cmds::CheckFramebufferStatus::Result));
133 expected.cmd.Init(1, result1.id, result1.offset);
135 EXPECT_CALL(*command_buffer(), OnFlush())
136 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
137 .RetiresOnSaturation();
139 GLboolean result = gl_->CheckFramebufferStatus(1);
140 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
141 EXPECT_TRUE(result);
144 TEST_F(GLES2ImplementationTest, Clear) {
145 struct Cmds {
146 cmds::Clear cmd;
148 Cmds expected;
149 expected.cmd.Init(1);
151 gl_->Clear(1);
152 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
155 TEST_F(GLES2ImplementationTest, ClearColor) {
156 struct Cmds {
157 cmds::ClearColor cmd;
159 Cmds expected;
160 expected.cmd.Init(1, 2, 3, 4);
162 gl_->ClearColor(1, 2, 3, 4);
163 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
166 TEST_F(GLES2ImplementationTest, ClearDepthf) {
167 struct Cmds {
168 cmds::ClearDepthf cmd;
170 Cmds expected;
171 expected.cmd.Init(0.5f);
173 gl_->ClearDepthf(0.5f);
174 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
177 TEST_F(GLES2ImplementationTest, ClearStencil) {
178 struct Cmds {
179 cmds::ClearStencil cmd;
181 Cmds expected;
182 expected.cmd.Init(1);
184 gl_->ClearStencil(1);
185 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
188 TEST_F(GLES2ImplementationTest, ColorMask) {
189 struct Cmds {
190 cmds::ColorMask cmd;
192 Cmds expected;
193 expected.cmd.Init(true, true, true, true);
195 gl_->ColorMask(true, true, true, true);
196 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
199 TEST_F(GLES2ImplementationTest, CompileShader) {
200 struct Cmds {
201 cmds::CompileShader cmd;
203 Cmds expected;
204 expected.cmd.Init(1);
206 gl_->CompileShader(1);
207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
209 // TODO: Implement unit test for CompressedTexImage2D
210 // TODO: Implement unit test for CompressedTexSubImage2D
212 TEST_F(GLES2ImplementationTest, CopyTexImage2D) {
213 struct Cmds {
214 cmds::CopyTexImage2D cmd;
216 Cmds expected;
217 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7);
219 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0);
220 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
223 TEST_F(GLES2ImplementationTest, CopyTexImage2DInvalidConstantArg7) {
224 gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 1);
225 EXPECT_TRUE(NoCommandsWritten());
226 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
229 TEST_F(GLES2ImplementationTest, CopyTexSubImage2D) {
230 struct Cmds {
231 cmds::CopyTexSubImage2D cmd;
233 Cmds expected;
234 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
236 gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
237 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
240 TEST_F(GLES2ImplementationTest, CullFace) {
241 struct Cmds {
242 cmds::CullFace cmd;
244 Cmds expected;
245 expected.cmd.Init(GL_FRONT);
247 gl_->CullFace(GL_FRONT);
248 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
251 TEST_F(GLES2ImplementationTest, DeleteBuffers) {
252 GLuint ids[2] = {kBuffersStartId, kBuffersStartId + 1};
253 struct Cmds {
254 cmds::DeleteBuffersImmediate del;
255 GLuint data[2];
257 Cmds expected;
258 expected.del.Init(arraysize(ids), &ids[0]);
259 expected.data[0] = kBuffersStartId;
260 expected.data[1] = kBuffersStartId + 1;
261 gl_->DeleteBuffers(arraysize(ids), &ids[0]);
262 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
265 TEST_F(GLES2ImplementationTest, DeleteFramebuffers) {
266 GLuint ids[2] = {kFramebuffersStartId, kFramebuffersStartId + 1};
267 struct Cmds {
268 cmds::DeleteFramebuffersImmediate del;
269 GLuint data[2];
271 Cmds expected;
272 expected.del.Init(arraysize(ids), &ids[0]);
273 expected.data[0] = kFramebuffersStartId;
274 expected.data[1] = kFramebuffersStartId + 1;
275 gl_->DeleteFramebuffers(arraysize(ids), &ids[0]);
276 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
279 TEST_F(GLES2ImplementationTest, DeleteProgram) {
280 struct Cmds {
281 cmds::DeleteProgram cmd;
283 Cmds expected;
284 expected.cmd.Init(1);
286 gl_->DeleteProgram(1);
287 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
290 TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) {
291 GLuint ids[2] = {kRenderbuffersStartId, kRenderbuffersStartId + 1};
292 struct Cmds {
293 cmds::DeleteRenderbuffersImmediate del;
294 GLuint data[2];
296 Cmds expected;
297 expected.del.Init(arraysize(ids), &ids[0]);
298 expected.data[0] = kRenderbuffersStartId;
299 expected.data[1] = kRenderbuffersStartId + 1;
300 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]);
301 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
304 TEST_F(GLES2ImplementationTest, DeleteShader) {
305 struct Cmds {
306 cmds::DeleteShader cmd;
308 Cmds expected;
309 expected.cmd.Init(1);
311 gl_->DeleteShader(1);
312 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
315 TEST_F(GLES2ImplementationTest, DeleteTextures) {
316 GLuint ids[2] = {kTexturesStartId, kTexturesStartId + 1};
317 struct Cmds {
318 cmds::DeleteTexturesImmediate del;
319 GLuint data[2];
321 Cmds expected;
322 expected.del.Init(arraysize(ids), &ids[0]);
323 expected.data[0] = kTexturesStartId;
324 expected.data[1] = kTexturesStartId + 1;
325 gl_->DeleteTextures(arraysize(ids), &ids[0]);
326 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
329 TEST_F(GLES2ImplementationTest, DepthFunc) {
330 struct Cmds {
331 cmds::DepthFunc cmd;
333 Cmds expected;
334 expected.cmd.Init(GL_NEVER);
336 gl_->DepthFunc(GL_NEVER);
337 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
340 TEST_F(GLES2ImplementationTest, DepthMask) {
341 struct Cmds {
342 cmds::DepthMask cmd;
344 Cmds expected;
345 expected.cmd.Init(true);
347 gl_->DepthMask(true);
348 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
351 TEST_F(GLES2ImplementationTest, DepthRangef) {
352 struct Cmds {
353 cmds::DepthRangef cmd;
355 Cmds expected;
356 expected.cmd.Init(1, 2);
358 gl_->DepthRangef(1, 2);
359 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
362 TEST_F(GLES2ImplementationTest, DetachShader) {
363 struct Cmds {
364 cmds::DetachShader cmd;
366 Cmds expected;
367 expected.cmd.Init(1, 2);
369 gl_->DetachShader(1, 2);
370 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
373 TEST_F(GLES2ImplementationTest, DisableVertexAttribArray) {
374 struct Cmds {
375 cmds::DisableVertexAttribArray cmd;
377 Cmds expected;
378 expected.cmd.Init(1);
380 gl_->DisableVertexAttribArray(1);
381 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
384 TEST_F(GLES2ImplementationTest, DrawArrays) {
385 struct Cmds {
386 cmds::DrawArrays cmd;
388 Cmds expected;
389 expected.cmd.Init(GL_POINTS, 2, 3);
391 gl_->DrawArrays(GL_POINTS, 2, 3);
392 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
395 TEST_F(GLES2ImplementationTest, EnableVertexAttribArray) {
396 struct Cmds {
397 cmds::EnableVertexAttribArray cmd;
399 Cmds expected;
400 expected.cmd.Init(1);
402 gl_->EnableVertexAttribArray(1);
403 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
406 TEST_F(GLES2ImplementationTest, Flush) {
407 struct Cmds {
408 cmds::Flush cmd;
410 Cmds expected;
411 expected.cmd.Init();
413 gl_->Flush();
414 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
417 TEST_F(GLES2ImplementationTest, FramebufferRenderbuffer) {
418 struct Cmds {
419 cmds::FramebufferRenderbuffer cmd;
421 Cmds expected;
422 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4);
424 gl_->FramebufferRenderbuffer(
425 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4);
426 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
429 TEST_F(GLES2ImplementationTest, FramebufferTexture2D) {
430 struct Cmds {
431 cmds::FramebufferTexture2D cmd;
433 Cmds expected;
434 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4);
436 gl_->FramebufferTexture2D(
437 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0);
438 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
441 TEST_F(GLES2ImplementationTest, FramebufferTexture2DInvalidConstantArg4) {
442 gl_->FramebufferTexture2D(
443 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 1);
444 EXPECT_TRUE(NoCommandsWritten());
445 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
448 TEST_F(GLES2ImplementationTest, FrontFace) {
449 struct Cmds {
450 cmds::FrontFace cmd;
452 Cmds expected;
453 expected.cmd.Init(GL_CW);
455 gl_->FrontFace(GL_CW);
456 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
459 TEST_F(GLES2ImplementationTest, GenBuffers) {
460 GLuint ids[2] = {
463 struct Cmds {
464 cmds::GenBuffersImmediate gen;
465 GLuint data[2];
467 Cmds expected;
468 expected.gen.Init(arraysize(ids), &ids[0]);
469 expected.data[0] = kBuffersStartId;
470 expected.data[1] = kBuffersStartId + 1;
471 gl_->GenBuffers(arraysize(ids), &ids[0]);
472 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
473 EXPECT_EQ(kBuffersStartId, ids[0]);
474 EXPECT_EQ(kBuffersStartId + 1, ids[1]);
477 TEST_F(GLES2ImplementationTest, GenerateMipmap) {
478 struct Cmds {
479 cmds::GenerateMipmap cmd;
481 Cmds expected;
482 expected.cmd.Init(GL_TEXTURE_2D);
484 gl_->GenerateMipmap(GL_TEXTURE_2D);
485 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
488 TEST_F(GLES2ImplementationTest, GenFramebuffers) {
489 GLuint ids[2] = {
492 struct Cmds {
493 cmds::GenFramebuffersImmediate gen;
494 GLuint data[2];
496 Cmds expected;
497 expected.gen.Init(arraysize(ids), &ids[0]);
498 expected.data[0] = kFramebuffersStartId;
499 expected.data[1] = kFramebuffersStartId + 1;
500 gl_->GenFramebuffers(arraysize(ids), &ids[0]);
501 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
502 EXPECT_EQ(kFramebuffersStartId, ids[0]);
503 EXPECT_EQ(kFramebuffersStartId + 1, ids[1]);
506 TEST_F(GLES2ImplementationTest, GenRenderbuffers) {
507 GLuint ids[2] = {
510 struct Cmds {
511 cmds::GenRenderbuffersImmediate gen;
512 GLuint data[2];
514 Cmds expected;
515 expected.gen.Init(arraysize(ids), &ids[0]);
516 expected.data[0] = kRenderbuffersStartId;
517 expected.data[1] = kRenderbuffersStartId + 1;
518 gl_->GenRenderbuffers(arraysize(ids), &ids[0]);
519 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
520 EXPECT_EQ(kRenderbuffersStartId, ids[0]);
521 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]);
524 TEST_F(GLES2ImplementationTest, GenTextures) {
525 GLuint ids[2] = {
528 struct Cmds {
529 cmds::GenTexturesImmediate gen;
530 GLuint data[2];
532 Cmds expected;
533 expected.gen.Init(arraysize(ids), &ids[0]);
534 expected.data[0] = kTexturesStartId;
535 expected.data[1] = kTexturesStartId + 1;
536 gl_->GenTextures(arraysize(ids), &ids[0]);
537 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
538 EXPECT_EQ(kTexturesStartId, ids[0]);
539 EXPECT_EQ(kTexturesStartId + 1, ids[1]);
541 // TODO: Implement unit test for GetActiveAttrib
542 // TODO: Implement unit test for GetActiveUniform
543 // TODO: Implement unit test for GetAttachedShaders
544 // TODO: Implement unit test for GetAttribLocation
546 TEST_F(GLES2ImplementationTest, GetBooleanv) {
547 struct Cmds {
548 cmds::GetBooleanv cmd;
550 typedef cmds::GetBooleanv::Result Result;
551 Result::Type result = 0;
552 Cmds expected;
553 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
554 expected.cmd.Init(123, result1.id, result1.offset);
555 EXPECT_CALL(*command_buffer(), OnFlush())
556 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
557 .RetiresOnSaturation();
558 gl_->GetBooleanv(123, &result);
559 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
560 EXPECT_EQ(static_cast<Result::Type>(1), result);
563 TEST_F(GLES2ImplementationTest, GetBufferParameteriv) {
564 struct Cmds {
565 cmds::GetBufferParameteriv cmd;
567 typedef cmds::GetBufferParameteriv::Result Result;
568 Result::Type result = 0;
569 Cmds expected;
570 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
571 expected.cmd.Init(123, GL_BUFFER_SIZE, result1.id, result1.offset);
572 EXPECT_CALL(*command_buffer(), OnFlush())
573 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
574 .RetiresOnSaturation();
575 gl_->GetBufferParameteriv(123, GL_BUFFER_SIZE, &result);
576 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
577 EXPECT_EQ(static_cast<Result::Type>(1), result);
580 TEST_F(GLES2ImplementationTest, GetFloatv) {
581 struct Cmds {
582 cmds::GetFloatv cmd;
584 typedef cmds::GetFloatv::Result Result;
585 Result::Type result = 0;
586 Cmds expected;
587 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
588 expected.cmd.Init(123, result1.id, result1.offset);
589 EXPECT_CALL(*command_buffer(), OnFlush())
590 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
591 .RetiresOnSaturation();
592 gl_->GetFloatv(123, &result);
593 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
594 EXPECT_EQ(static_cast<Result::Type>(1), result);
597 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) {
598 struct Cmds {
599 cmds::GetFramebufferAttachmentParameteriv cmd;
601 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
602 Result::Type result = 0;
603 Cmds expected;
604 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
605 expected.cmd.Init(123,
606 GL_COLOR_ATTACHMENT0,
607 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
608 result1.id,
609 result1.offset);
610 EXPECT_CALL(*command_buffer(), OnFlush())
611 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
612 .RetiresOnSaturation();
613 gl_->GetFramebufferAttachmentParameteriv(
614 123,
615 GL_COLOR_ATTACHMENT0,
616 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
617 &result);
618 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
619 EXPECT_EQ(static_cast<Result::Type>(1), result);
622 TEST_F(GLES2ImplementationTest, GetIntegerv) {
623 struct Cmds {
624 cmds::GetIntegerv cmd;
626 typedef cmds::GetIntegerv::Result Result;
627 Result::Type result = 0;
628 Cmds expected;
629 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
630 expected.cmd.Init(123, result1.id, result1.offset);
631 EXPECT_CALL(*command_buffer(), OnFlush())
632 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
633 .RetiresOnSaturation();
634 gl_->GetIntegerv(123, &result);
635 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
636 EXPECT_EQ(static_cast<Result::Type>(1), result);
639 TEST_F(GLES2ImplementationTest, GetProgramiv) {
640 struct Cmds {
641 cmds::GetProgramiv cmd;
643 typedef cmds::GetProgramiv::Result Result;
644 Result::Type result = 0;
645 Cmds expected;
646 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
647 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset);
648 EXPECT_CALL(*command_buffer(), OnFlush())
649 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
650 .RetiresOnSaturation();
651 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result);
652 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
653 EXPECT_EQ(static_cast<Result::Type>(1), result);
655 // TODO: Implement unit test for GetProgramInfoLog
657 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) {
658 struct Cmds {
659 cmds::GetRenderbufferParameteriv cmd;
661 typedef cmds::GetRenderbufferParameteriv::Result Result;
662 Result::Type result = 0;
663 Cmds expected;
664 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
665 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset);
666 EXPECT_CALL(*command_buffer(), OnFlush())
667 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
668 .RetiresOnSaturation();
669 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result);
670 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
671 EXPECT_EQ(static_cast<Result::Type>(1), result);
674 TEST_F(GLES2ImplementationTest, GetShaderiv) {
675 struct Cmds {
676 cmds::GetShaderiv cmd;
678 typedef cmds::GetShaderiv::Result Result;
679 Result::Type result = 0;
680 Cmds expected;
681 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
682 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset);
683 EXPECT_CALL(*command_buffer(), OnFlush())
684 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
685 .RetiresOnSaturation();
686 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result);
687 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
688 EXPECT_EQ(static_cast<Result::Type>(1), result);
690 // TODO: Implement unit test for GetShaderInfoLog
691 // TODO: Implement unit test for GetShaderPrecisionFormat
693 TEST_F(GLES2ImplementationTest, GetTexParameterfv) {
694 struct Cmds {
695 cmds::GetTexParameterfv cmd;
697 typedef cmds::GetTexParameterfv::Result Result;
698 Result::Type result = 0;
699 Cmds expected;
700 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
701 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
702 EXPECT_CALL(*command_buffer(), OnFlush())
703 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
704 .RetiresOnSaturation();
705 gl_->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER, &result);
706 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
707 EXPECT_EQ(static_cast<Result::Type>(1), result);
710 TEST_F(GLES2ImplementationTest, GetTexParameteriv) {
711 struct Cmds {
712 cmds::GetTexParameteriv cmd;
714 typedef cmds::GetTexParameteriv::Result Result;
715 Result::Type result = 0;
716 Cmds expected;
717 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
718 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
719 EXPECT_CALL(*command_buffer(), OnFlush())
720 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
721 .RetiresOnSaturation();
722 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result);
723 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
724 EXPECT_EQ(static_cast<Result::Type>(1), result);
726 // TODO: Implement unit test for GetUniformfv
727 // TODO: Implement unit test for GetUniformiv
728 // TODO: Implement unit test for GetUniformLocation
730 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) {
731 struct Cmds {
732 cmds::GetVertexAttribfv cmd;
734 typedef cmds::GetVertexAttribfv::Result Result;
735 Result::Type result = 0;
736 Cmds expected;
737 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
738 expected.cmd.Init(
739 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset);
740 EXPECT_CALL(*command_buffer(), OnFlush())
741 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
742 .RetiresOnSaturation();
743 gl_->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
744 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
745 EXPECT_EQ(static_cast<Result::Type>(1), result);
748 TEST_F(GLES2ImplementationTest, GetVertexAttribiv) {
749 struct Cmds {
750 cmds::GetVertexAttribiv cmd;
752 typedef cmds::GetVertexAttribiv::Result Result;
753 Result::Type result = 0;
754 Cmds expected;
755 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
756 expected.cmd.Init(
757 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset);
758 EXPECT_CALL(*command_buffer(), OnFlush())
759 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
760 .RetiresOnSaturation();
761 gl_->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
762 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
763 EXPECT_EQ(static_cast<Result::Type>(1), result);
766 TEST_F(GLES2ImplementationTest, Hint) {
767 struct Cmds {
768 cmds::Hint cmd;
770 Cmds expected;
771 expected.cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
773 gl_->Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
774 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
777 TEST_F(GLES2ImplementationTest, IsBuffer) {
778 struct Cmds {
779 cmds::IsBuffer cmd;
782 Cmds expected;
783 ExpectedMemoryInfo result1 =
784 GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result));
785 expected.cmd.Init(1, result1.id, result1.offset);
787 EXPECT_CALL(*command_buffer(), OnFlush())
788 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
789 .RetiresOnSaturation();
791 GLboolean result = gl_->IsBuffer(1);
792 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
793 EXPECT_TRUE(result);
796 TEST_F(GLES2ImplementationTest, IsEnabled) {
797 struct Cmds {
798 cmds::IsEnabled cmd;
801 Cmds expected;
802 ExpectedMemoryInfo result1 =
803 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result));
804 expected.cmd.Init(1, result1.id, result1.offset);
806 EXPECT_CALL(*command_buffer(), OnFlush())
807 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
808 .RetiresOnSaturation();
810 GLboolean result = gl_->IsEnabled(1);
811 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
812 EXPECT_TRUE(result);
815 TEST_F(GLES2ImplementationTest, IsFramebuffer) {
816 struct Cmds {
817 cmds::IsFramebuffer cmd;
820 Cmds expected;
821 ExpectedMemoryInfo result1 =
822 GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result));
823 expected.cmd.Init(1, result1.id, result1.offset);
825 EXPECT_CALL(*command_buffer(), OnFlush())
826 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
827 .RetiresOnSaturation();
829 GLboolean result = gl_->IsFramebuffer(1);
830 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
831 EXPECT_TRUE(result);
834 TEST_F(GLES2ImplementationTest, IsProgram) {
835 struct Cmds {
836 cmds::IsProgram cmd;
839 Cmds expected;
840 ExpectedMemoryInfo result1 =
841 GetExpectedResultMemory(sizeof(cmds::IsProgram::Result));
842 expected.cmd.Init(1, result1.id, result1.offset);
844 EXPECT_CALL(*command_buffer(), OnFlush())
845 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
846 .RetiresOnSaturation();
848 GLboolean result = gl_->IsProgram(1);
849 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
850 EXPECT_TRUE(result);
853 TEST_F(GLES2ImplementationTest, IsRenderbuffer) {
854 struct Cmds {
855 cmds::IsRenderbuffer cmd;
858 Cmds expected;
859 ExpectedMemoryInfo result1 =
860 GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result));
861 expected.cmd.Init(1, result1.id, result1.offset);
863 EXPECT_CALL(*command_buffer(), OnFlush())
864 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
865 .RetiresOnSaturation();
867 GLboolean result = gl_->IsRenderbuffer(1);
868 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
869 EXPECT_TRUE(result);
872 TEST_F(GLES2ImplementationTest, IsShader) {
873 struct Cmds {
874 cmds::IsShader cmd;
877 Cmds expected;
878 ExpectedMemoryInfo result1 =
879 GetExpectedResultMemory(sizeof(cmds::IsShader::Result));
880 expected.cmd.Init(1, result1.id, result1.offset);
882 EXPECT_CALL(*command_buffer(), OnFlush())
883 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
884 .RetiresOnSaturation();
886 GLboolean result = gl_->IsShader(1);
887 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
888 EXPECT_TRUE(result);
891 TEST_F(GLES2ImplementationTest, IsTexture) {
892 struct Cmds {
893 cmds::IsTexture cmd;
896 Cmds expected;
897 ExpectedMemoryInfo result1 =
898 GetExpectedResultMemory(sizeof(cmds::IsTexture::Result));
899 expected.cmd.Init(1, result1.id, result1.offset);
901 EXPECT_CALL(*command_buffer(), OnFlush())
902 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
903 .RetiresOnSaturation();
905 GLboolean result = gl_->IsTexture(1);
906 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
907 EXPECT_TRUE(result);
910 TEST_F(GLES2ImplementationTest, LineWidth) {
911 struct Cmds {
912 cmds::LineWidth cmd;
914 Cmds expected;
915 expected.cmd.Init(0.5f);
917 gl_->LineWidth(0.5f);
918 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
921 TEST_F(GLES2ImplementationTest, LinkProgram) {
922 struct Cmds {
923 cmds::LinkProgram cmd;
925 Cmds expected;
926 expected.cmd.Init(1);
928 gl_->LinkProgram(1);
929 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
932 TEST_F(GLES2ImplementationTest, PixelStorei) {
933 struct Cmds {
934 cmds::PixelStorei cmd;
936 Cmds expected;
937 expected.cmd.Init(GL_PACK_ALIGNMENT, 1);
939 gl_->PixelStorei(GL_PACK_ALIGNMENT, 1);
940 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
943 TEST_F(GLES2ImplementationTest, PolygonOffset) {
944 struct Cmds {
945 cmds::PolygonOffset cmd;
947 Cmds expected;
948 expected.cmd.Init(1, 2);
950 gl_->PolygonOffset(1, 2);
951 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
954 TEST_F(GLES2ImplementationTest, ReleaseShaderCompiler) {
955 struct Cmds {
956 cmds::ReleaseShaderCompiler cmd;
958 Cmds expected;
959 expected.cmd.Init();
961 gl_->ReleaseShaderCompiler();
962 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
965 TEST_F(GLES2ImplementationTest, RenderbufferStorage) {
966 struct Cmds {
967 cmds::RenderbufferStorage cmd;
969 Cmds expected;
970 expected.cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
972 gl_->RenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
973 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
976 TEST_F(GLES2ImplementationTest, SampleCoverage) {
977 struct Cmds {
978 cmds::SampleCoverage cmd;
980 Cmds expected;
981 expected.cmd.Init(1, true);
983 gl_->SampleCoverage(1, true);
984 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
987 TEST_F(GLES2ImplementationTest, Scissor) {
988 struct Cmds {
989 cmds::Scissor cmd;
991 Cmds expected;
992 expected.cmd.Init(1, 2, 3, 4);
994 gl_->Scissor(1, 2, 3, 4);
995 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
998 TEST_F(GLES2ImplementationTest, StencilFunc) {
999 struct Cmds {
1000 cmds::StencilFunc cmd;
1002 Cmds expected;
1003 expected.cmd.Init(GL_NEVER, 2, 3);
1005 gl_->StencilFunc(GL_NEVER, 2, 3);
1006 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1009 TEST_F(GLES2ImplementationTest, StencilFuncSeparate) {
1010 struct Cmds {
1011 cmds::StencilFuncSeparate cmd;
1013 Cmds expected;
1014 expected.cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
1016 gl_->StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4);
1017 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1020 TEST_F(GLES2ImplementationTest, StencilMask) {
1021 struct Cmds {
1022 cmds::StencilMask cmd;
1024 Cmds expected;
1025 expected.cmd.Init(1);
1027 gl_->StencilMask(1);
1028 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1031 TEST_F(GLES2ImplementationTest, StencilMaskSeparate) {
1032 struct Cmds {
1033 cmds::StencilMaskSeparate cmd;
1035 Cmds expected;
1036 expected.cmd.Init(GL_FRONT, 2);
1038 gl_->StencilMaskSeparate(GL_FRONT, 2);
1039 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1042 TEST_F(GLES2ImplementationTest, StencilOp) {
1043 struct Cmds {
1044 cmds::StencilOp cmd;
1046 Cmds expected;
1047 expected.cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1049 gl_->StencilOp(GL_KEEP, GL_INCR, GL_KEEP);
1050 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1053 TEST_F(GLES2ImplementationTest, StencilOpSeparate) {
1054 struct Cmds {
1055 cmds::StencilOpSeparate cmd;
1057 Cmds expected;
1058 expected.cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1060 gl_->StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1061 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1064 TEST_F(GLES2ImplementationTest, TexParameterf) {
1065 struct Cmds {
1066 cmds::TexParameterf cmd;
1068 Cmds expected;
1069 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1071 gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1072 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1075 TEST_F(GLES2ImplementationTest, TexParameterfv) {
1076 GLfloat data[1] = {0};
1077 struct Cmds {
1078 cmds::TexParameterfvImmediate cmd;
1079 GLfloat data[1];
1082 for (int jj = 0; jj < 1; ++jj) {
1083 data[jj] = static_cast<GLfloat>(jj);
1085 Cmds expected;
1086 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1087 gl_->TexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1088 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1091 TEST_F(GLES2ImplementationTest, TexParameteri) {
1092 struct Cmds {
1093 cmds::TexParameteri cmd;
1095 Cmds expected;
1096 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1098 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1099 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1102 TEST_F(GLES2ImplementationTest, TexParameteriv) {
1103 GLint data[1] = {0};
1104 struct Cmds {
1105 cmds::TexParameterivImmediate cmd;
1106 GLint data[1];
1109 for (int jj = 0; jj < 1; ++jj) {
1110 data[jj] = static_cast<GLint>(jj);
1112 Cmds expected;
1113 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1114 gl_->TexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1115 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1118 TEST_F(GLES2ImplementationTest, Uniform1f) {
1119 struct Cmds {
1120 cmds::Uniform1f cmd;
1122 Cmds expected;
1123 expected.cmd.Init(1, 2);
1125 gl_->Uniform1f(1, 2);
1126 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1129 TEST_F(GLES2ImplementationTest, Uniform1fv) {
1130 GLfloat data[2][1] = {{0}};
1131 struct Cmds {
1132 cmds::Uniform1fvImmediate cmd;
1133 GLfloat data[2][1];
1136 Cmds expected;
1137 for (int ii = 0; ii < 2; ++ii) {
1138 for (int jj = 0; jj < 1; ++jj) {
1139 data[ii][jj] = static_cast<GLfloat>(ii * 1 + jj);
1142 expected.cmd.Init(1, 2, &data[0][0]);
1143 gl_->Uniform1fv(1, 2, &data[0][0]);
1144 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1147 TEST_F(GLES2ImplementationTest, Uniform1i) {
1148 struct Cmds {
1149 cmds::Uniform1i cmd;
1151 Cmds expected;
1152 expected.cmd.Init(1, 2);
1154 gl_->Uniform1i(1, 2);
1155 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1158 TEST_F(GLES2ImplementationTest, Uniform1iv) {
1159 GLint data[2][1] = {{0}};
1160 struct Cmds {
1161 cmds::Uniform1ivImmediate cmd;
1162 GLint data[2][1];
1165 Cmds expected;
1166 for (int ii = 0; ii < 2; ++ii) {
1167 for (int jj = 0; jj < 1; ++jj) {
1168 data[ii][jj] = static_cast<GLint>(ii * 1 + jj);
1171 expected.cmd.Init(1, 2, &data[0][0]);
1172 gl_->Uniform1iv(1, 2, &data[0][0]);
1173 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1176 TEST_F(GLES2ImplementationTest, Uniform2f) {
1177 struct Cmds {
1178 cmds::Uniform2f cmd;
1180 Cmds expected;
1181 expected.cmd.Init(1, 2, 3);
1183 gl_->Uniform2f(1, 2, 3);
1184 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1187 TEST_F(GLES2ImplementationTest, Uniform2fv) {
1188 GLfloat data[2][2] = {{0}};
1189 struct Cmds {
1190 cmds::Uniform2fvImmediate cmd;
1191 GLfloat data[2][2];
1194 Cmds expected;
1195 for (int ii = 0; ii < 2; ++ii) {
1196 for (int jj = 0; jj < 2; ++jj) {
1197 data[ii][jj] = static_cast<GLfloat>(ii * 2 + jj);
1200 expected.cmd.Init(1, 2, &data[0][0]);
1201 gl_->Uniform2fv(1, 2, &data[0][0]);
1202 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1205 TEST_F(GLES2ImplementationTest, Uniform2i) {
1206 struct Cmds {
1207 cmds::Uniform2i cmd;
1209 Cmds expected;
1210 expected.cmd.Init(1, 2, 3);
1212 gl_->Uniform2i(1, 2, 3);
1213 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1216 TEST_F(GLES2ImplementationTest, Uniform2iv) {
1217 GLint data[2][2] = {{0}};
1218 struct Cmds {
1219 cmds::Uniform2ivImmediate cmd;
1220 GLint data[2][2];
1223 Cmds expected;
1224 for (int ii = 0; ii < 2; ++ii) {
1225 for (int jj = 0; jj < 2; ++jj) {
1226 data[ii][jj] = static_cast<GLint>(ii * 2 + jj);
1229 expected.cmd.Init(1, 2, &data[0][0]);
1230 gl_->Uniform2iv(1, 2, &data[0][0]);
1231 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1234 TEST_F(GLES2ImplementationTest, Uniform3f) {
1235 struct Cmds {
1236 cmds::Uniform3f cmd;
1238 Cmds expected;
1239 expected.cmd.Init(1, 2, 3, 4);
1241 gl_->Uniform3f(1, 2, 3, 4);
1242 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1245 TEST_F(GLES2ImplementationTest, Uniform3fv) {
1246 GLfloat data[2][3] = {{0}};
1247 struct Cmds {
1248 cmds::Uniform3fvImmediate cmd;
1249 GLfloat data[2][3];
1252 Cmds expected;
1253 for (int ii = 0; ii < 2; ++ii) {
1254 for (int jj = 0; jj < 3; ++jj) {
1255 data[ii][jj] = static_cast<GLfloat>(ii * 3 + jj);
1258 expected.cmd.Init(1, 2, &data[0][0]);
1259 gl_->Uniform3fv(1, 2, &data[0][0]);
1260 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1263 TEST_F(GLES2ImplementationTest, Uniform3i) {
1264 struct Cmds {
1265 cmds::Uniform3i cmd;
1267 Cmds expected;
1268 expected.cmd.Init(1, 2, 3, 4);
1270 gl_->Uniform3i(1, 2, 3, 4);
1271 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1274 TEST_F(GLES2ImplementationTest, Uniform3iv) {
1275 GLint data[2][3] = {{0}};
1276 struct Cmds {
1277 cmds::Uniform3ivImmediate cmd;
1278 GLint data[2][3];
1281 Cmds expected;
1282 for (int ii = 0; ii < 2; ++ii) {
1283 for (int jj = 0; jj < 3; ++jj) {
1284 data[ii][jj] = static_cast<GLint>(ii * 3 + jj);
1287 expected.cmd.Init(1, 2, &data[0][0]);
1288 gl_->Uniform3iv(1, 2, &data[0][0]);
1289 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1292 TEST_F(GLES2ImplementationTest, Uniform4f) {
1293 struct Cmds {
1294 cmds::Uniform4f cmd;
1296 Cmds expected;
1297 expected.cmd.Init(1, 2, 3, 4, 5);
1299 gl_->Uniform4f(1, 2, 3, 4, 5);
1300 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1303 TEST_F(GLES2ImplementationTest, Uniform4fv) {
1304 GLfloat data[2][4] = {{0}};
1305 struct Cmds {
1306 cmds::Uniform4fvImmediate cmd;
1307 GLfloat data[2][4];
1310 Cmds expected;
1311 for (int ii = 0; ii < 2; ++ii) {
1312 for (int jj = 0; jj < 4; ++jj) {
1313 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
1316 expected.cmd.Init(1, 2, &data[0][0]);
1317 gl_->Uniform4fv(1, 2, &data[0][0]);
1318 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1321 TEST_F(GLES2ImplementationTest, Uniform4i) {
1322 struct Cmds {
1323 cmds::Uniform4i cmd;
1325 Cmds expected;
1326 expected.cmd.Init(1, 2, 3, 4, 5);
1328 gl_->Uniform4i(1, 2, 3, 4, 5);
1329 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1332 TEST_F(GLES2ImplementationTest, Uniform4iv) {
1333 GLint data[2][4] = {{0}};
1334 struct Cmds {
1335 cmds::Uniform4ivImmediate cmd;
1336 GLint data[2][4];
1339 Cmds expected;
1340 for (int ii = 0; ii < 2; ++ii) {
1341 for (int jj = 0; jj < 4; ++jj) {
1342 data[ii][jj] = static_cast<GLint>(ii * 4 + jj);
1345 expected.cmd.Init(1, 2, &data[0][0]);
1346 gl_->Uniform4iv(1, 2, &data[0][0]);
1347 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1350 TEST_F(GLES2ImplementationTest, UniformMatrix2fv) {
1351 GLfloat data[2][4] = {{0}};
1352 struct Cmds {
1353 cmds::UniformMatrix2fvImmediate cmd;
1354 GLfloat data[2][4];
1357 Cmds expected;
1358 for (int ii = 0; ii < 2; ++ii) {
1359 for (int jj = 0; jj < 4; ++jj) {
1360 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
1363 expected.cmd.Init(1, 2, &data[0][0]);
1364 gl_->UniformMatrix2fv(1, 2, false, &data[0][0]);
1365 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1368 TEST_F(GLES2ImplementationTest, UniformMatrix2fvInvalidConstantArg2) {
1369 GLfloat data[2][4] = {{0}};
1370 for (int ii = 0; ii < 2; ++ii) {
1371 for (int jj = 0; jj < 4; ++jj) {
1372 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
1375 gl_->UniformMatrix2fv(1, 2, true, &data[0][0]);
1376 EXPECT_TRUE(NoCommandsWritten());
1377 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
1380 TEST_F(GLES2ImplementationTest, UniformMatrix3fv) {
1381 GLfloat data[2][9] = {{0}};
1382 struct Cmds {
1383 cmds::UniformMatrix3fvImmediate cmd;
1384 GLfloat data[2][9];
1387 Cmds expected;
1388 for (int ii = 0; ii < 2; ++ii) {
1389 for (int jj = 0; jj < 9; ++jj) {
1390 data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj);
1393 expected.cmd.Init(1, 2, &data[0][0]);
1394 gl_->UniformMatrix3fv(1, 2, false, &data[0][0]);
1395 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1398 TEST_F(GLES2ImplementationTest, UniformMatrix3fvInvalidConstantArg2) {
1399 GLfloat data[2][9] = {{0}};
1400 for (int ii = 0; ii < 2; ++ii) {
1401 for (int jj = 0; jj < 9; ++jj) {
1402 data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj);
1405 gl_->UniformMatrix3fv(1, 2, true, &data[0][0]);
1406 EXPECT_TRUE(NoCommandsWritten());
1407 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
1410 TEST_F(GLES2ImplementationTest, UniformMatrix4fv) {
1411 GLfloat data[2][16] = {{0}};
1412 struct Cmds {
1413 cmds::UniformMatrix4fvImmediate cmd;
1414 GLfloat data[2][16];
1417 Cmds expected;
1418 for (int ii = 0; ii < 2; ++ii) {
1419 for (int jj = 0; jj < 16; ++jj) {
1420 data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj);
1423 expected.cmd.Init(1, 2, &data[0][0]);
1424 gl_->UniformMatrix4fv(1, 2, false, &data[0][0]);
1425 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1428 TEST_F(GLES2ImplementationTest, UniformMatrix4fvInvalidConstantArg2) {
1429 GLfloat data[2][16] = {{0}};
1430 for (int ii = 0; ii < 2; ++ii) {
1431 for (int jj = 0; jj < 16; ++jj) {
1432 data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj);
1435 gl_->UniformMatrix4fv(1, 2, true, &data[0][0]);
1436 EXPECT_TRUE(NoCommandsWritten());
1437 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
1440 TEST_F(GLES2ImplementationTest, UseProgram) {
1441 struct Cmds {
1442 cmds::UseProgram cmd;
1444 Cmds expected;
1445 expected.cmd.Init(1);
1447 gl_->UseProgram(1);
1448 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1449 ClearCommands();
1450 gl_->UseProgram(1);
1451 EXPECT_TRUE(NoCommandsWritten());
1454 TEST_F(GLES2ImplementationTest, ValidateProgram) {
1455 struct Cmds {
1456 cmds::ValidateProgram cmd;
1458 Cmds expected;
1459 expected.cmd.Init(1);
1461 gl_->ValidateProgram(1);
1462 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1465 TEST_F(GLES2ImplementationTest, VertexAttrib1f) {
1466 struct Cmds {
1467 cmds::VertexAttrib1f cmd;
1469 Cmds expected;
1470 expected.cmd.Init(1, 2);
1472 gl_->VertexAttrib1f(1, 2);
1473 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1476 TEST_F(GLES2ImplementationTest, VertexAttrib1fv) {
1477 GLfloat data[1] = {0};
1478 struct Cmds {
1479 cmds::VertexAttrib1fvImmediate cmd;
1480 GLfloat data[1];
1483 for (int jj = 0; jj < 1; ++jj) {
1484 data[jj] = static_cast<GLfloat>(jj);
1486 Cmds expected;
1487 expected.cmd.Init(1, &data[0]);
1488 gl_->VertexAttrib1fv(1, &data[0]);
1489 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1492 TEST_F(GLES2ImplementationTest, VertexAttrib2f) {
1493 struct Cmds {
1494 cmds::VertexAttrib2f cmd;
1496 Cmds expected;
1497 expected.cmd.Init(1, 2, 3);
1499 gl_->VertexAttrib2f(1, 2, 3);
1500 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1503 TEST_F(GLES2ImplementationTest, VertexAttrib2fv) {
1504 GLfloat data[2] = {0};
1505 struct Cmds {
1506 cmds::VertexAttrib2fvImmediate cmd;
1507 GLfloat data[2];
1510 for (int jj = 0; jj < 2; ++jj) {
1511 data[jj] = static_cast<GLfloat>(jj);
1513 Cmds expected;
1514 expected.cmd.Init(1, &data[0]);
1515 gl_->VertexAttrib2fv(1, &data[0]);
1516 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1519 TEST_F(GLES2ImplementationTest, VertexAttrib3f) {
1520 struct Cmds {
1521 cmds::VertexAttrib3f cmd;
1523 Cmds expected;
1524 expected.cmd.Init(1, 2, 3, 4);
1526 gl_->VertexAttrib3f(1, 2, 3, 4);
1527 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1530 TEST_F(GLES2ImplementationTest, VertexAttrib3fv) {
1531 GLfloat data[3] = {0};
1532 struct Cmds {
1533 cmds::VertexAttrib3fvImmediate cmd;
1534 GLfloat data[3];
1537 for (int jj = 0; jj < 3; ++jj) {
1538 data[jj] = static_cast<GLfloat>(jj);
1540 Cmds expected;
1541 expected.cmd.Init(1, &data[0]);
1542 gl_->VertexAttrib3fv(1, &data[0]);
1543 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1546 TEST_F(GLES2ImplementationTest, VertexAttrib4f) {
1547 struct Cmds {
1548 cmds::VertexAttrib4f cmd;
1550 Cmds expected;
1551 expected.cmd.Init(1, 2, 3, 4, 5);
1553 gl_->VertexAttrib4f(1, 2, 3, 4, 5);
1554 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1557 TEST_F(GLES2ImplementationTest, VertexAttrib4fv) {
1558 GLfloat data[4] = {0};
1559 struct Cmds {
1560 cmds::VertexAttrib4fvImmediate cmd;
1561 GLfloat data[4];
1564 for (int jj = 0; jj < 4; ++jj) {
1565 data[jj] = static_cast<GLfloat>(jj);
1567 Cmds expected;
1568 expected.cmd.Init(1, &data[0]);
1569 gl_->VertexAttrib4fv(1, &data[0]);
1570 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1573 TEST_F(GLES2ImplementationTest, Viewport) {
1574 struct Cmds {
1575 cmds::Viewport cmd;
1577 Cmds expected;
1578 expected.cmd.Init(1, 2, 3, 4);
1580 gl_->Viewport(1, 2, 3, 4);
1581 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1584 TEST_F(GLES2ImplementationTest, BlitFramebufferCHROMIUM) {
1585 struct Cmds {
1586 cmds::BlitFramebufferCHROMIUM cmd;
1588 Cmds expected;
1589 expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
1591 gl_->BlitFramebufferCHROMIUM(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
1592 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1595 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleCHROMIUM) {
1596 struct Cmds {
1597 cmds::RenderbufferStorageMultisampleCHROMIUM cmd;
1599 Cmds expected;
1600 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1602 gl_->RenderbufferStorageMultisampleCHROMIUM(
1603 GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1604 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1607 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleEXT) {
1608 struct Cmds {
1609 cmds::RenderbufferStorageMultisampleEXT cmd;
1611 Cmds expected;
1612 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1614 gl_->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1615 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1618 TEST_F(GLES2ImplementationTest, FramebufferTexture2DMultisampleEXT) {
1619 struct Cmds {
1620 cmds::FramebufferTexture2DMultisampleEXT cmd;
1622 Cmds expected;
1623 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 6);
1625 gl_->FramebufferTexture2DMultisampleEXT(
1626 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0, 6);
1627 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1630 TEST_F(GLES2ImplementationTest,
1631 FramebufferTexture2DMultisampleEXTInvalidConstantArg4) {
1632 gl_->FramebufferTexture2DMultisampleEXT(
1633 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 1, 6);
1634 EXPECT_TRUE(NoCommandsWritten());
1635 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
1638 TEST_F(GLES2ImplementationTest, TexStorage2DEXT) {
1639 struct Cmds {
1640 cmds::TexStorage2DEXT cmd;
1642 Cmds expected;
1643 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
1645 gl_->TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
1646 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1649 TEST_F(GLES2ImplementationTest, GenQueriesEXT) {
1650 GLuint ids[2] = {
1653 struct Cmds {
1654 cmds::GenQueriesEXTImmediate gen;
1655 GLuint data[2];
1657 Cmds expected;
1658 expected.gen.Init(arraysize(ids), &ids[0]);
1659 expected.data[0] = kQueriesStartId;
1660 expected.data[1] = kQueriesStartId + 1;
1661 gl_->GenQueriesEXT(arraysize(ids), &ids[0]);
1662 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1663 EXPECT_EQ(kQueriesStartId, ids[0]);
1664 EXPECT_EQ(kQueriesStartId + 1, ids[1]);
1667 TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) {
1668 GLuint ids[2] = {kQueriesStartId, kQueriesStartId + 1};
1669 struct Cmds {
1670 cmds::DeleteQueriesEXTImmediate del;
1671 GLuint data[2];
1673 Cmds expected;
1674 expected.del.Init(arraysize(ids), &ids[0]);
1675 expected.data[0] = kQueriesStartId;
1676 expected.data[1] = kQueriesStartId + 1;
1677 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]);
1678 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1680 // TODO: Implement unit test for BeginQueryEXT
1681 // TODO: Implement unit test for InsertEventMarkerEXT
1682 // TODO: Implement unit test for PushGroupMarkerEXT
1684 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) {
1685 struct Cmds {
1686 cmds::PopGroupMarkerEXT cmd;
1688 Cmds expected;
1689 expected.cmd.Init();
1691 gl_->PopGroupMarkerEXT();
1692 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1695 TEST_F(GLES2ImplementationTest, GenVertexArraysOES) {
1696 GLuint ids[2] = {
1699 struct Cmds {
1700 cmds::GenVertexArraysOESImmediate gen;
1701 GLuint data[2];
1703 Cmds expected;
1704 expected.gen.Init(arraysize(ids), &ids[0]);
1705 expected.data[0] = kVertexArraysStartId;
1706 expected.data[1] = kVertexArraysStartId + 1;
1707 gl_->GenVertexArraysOES(arraysize(ids), &ids[0]);
1708 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1709 EXPECT_EQ(kVertexArraysStartId, ids[0]);
1710 EXPECT_EQ(kVertexArraysStartId + 1, ids[1]);
1713 TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) {
1714 GLuint ids[2] = {kVertexArraysStartId, kVertexArraysStartId + 1};
1715 struct Cmds {
1716 cmds::DeleteVertexArraysOESImmediate del;
1717 GLuint data[2];
1719 Cmds expected;
1720 expected.del.Init(arraysize(ids), &ids[0]);
1721 expected.data[0] = kVertexArraysStartId;
1722 expected.data[1] = kVertexArraysStartId + 1;
1723 gl_->DeleteVertexArraysOES(arraysize(ids), &ids[0]);
1724 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1727 TEST_F(GLES2ImplementationTest, IsVertexArrayOES) {
1728 struct Cmds {
1729 cmds::IsVertexArrayOES cmd;
1732 Cmds expected;
1733 ExpectedMemoryInfo result1 =
1734 GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result));
1735 expected.cmd.Init(1, result1.id, result1.offset);
1737 EXPECT_CALL(*command_buffer(), OnFlush())
1738 .WillOnce(SetMemory(result1.ptr, uint32_t(1)))
1739 .RetiresOnSaturation();
1741 GLboolean result = gl_->IsVertexArrayOES(1);
1742 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1743 EXPECT_TRUE(result);
1745 // TODO: Implement unit test for GenSharedIdsCHROMIUM
1746 // TODO: Implement unit test for DeleteSharedIdsCHROMIUM
1747 // TODO: Implement unit test for RegisterSharedIdsCHROMIUM
1748 // TODO: Implement unit test for EnableFeatureCHROMIUM
1750 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) {
1751 struct Cmds {
1752 cmds::ResizeCHROMIUM cmd;
1754 Cmds expected;
1755 expected.cmd.Init(1, 2, 3);
1757 gl_->ResizeCHROMIUM(1, 2, 3);
1758 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1760 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM
1761 // TODO: Implement unit test for CreateStreamTextureCHROMIUM
1762 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE
1764 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) {
1765 struct Cmds {
1766 cmds::TexImageIOSurface2DCHROMIUM cmd;
1768 Cmds expected;
1769 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5);
1771 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5);
1772 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1775 TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) {
1776 struct Cmds {
1777 cmds::CopyTextureCHROMIUM cmd;
1779 Cmds expected;
1780 expected.cmd.Init(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
1782 gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
1783 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1786 TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) {
1787 struct Cmds {
1788 cmds::DrawArraysInstancedANGLE cmd;
1790 Cmds expected;
1791 expected.cmd.Init(GL_POINTS, 2, 3, 4);
1793 gl_->DrawArraysInstancedANGLE(GL_POINTS, 2, 3, 4);
1794 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1797 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) {
1798 struct Cmds {
1799 cmds::VertexAttribDivisorANGLE cmd;
1801 Cmds expected;
1802 expected.cmd.Init(1, 2);
1804 gl_->VertexAttribDivisorANGLE(1, 2);
1805 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1807 // TODO: Implement unit test for GenMailboxCHROMIUM
1808 // TODO: Implement unit test for BindUniformLocationCHROMIUM
1810 TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) {
1811 struct Cmds {
1812 cmds::BindTexImage2DCHROMIUM cmd;
1814 Cmds expected;
1815 expected.cmd.Init(GL_TEXTURE_2D, 2);
1817 gl_->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
1818 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1821 TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) {
1822 struct Cmds {
1823 cmds::ReleaseTexImage2DCHROMIUM cmd;
1825 Cmds expected;
1826 expected.cmd.Init(GL_TEXTURE_2D, 2);
1828 gl_->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
1829 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1832 TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) {
1833 GLenum data[2][1] = {{0}};
1834 struct Cmds {
1835 cmds::DiscardFramebufferEXTImmediate cmd;
1836 GLenum data[2][1];
1839 Cmds expected;
1840 for (int ii = 0; ii < 2; ++ii) {
1841 for (int jj = 0; jj < 1; ++jj) {
1842 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1845 expected.cmd.Init(1, 2, &data[0][0]);
1846 gl_->DiscardFramebufferEXT(1, 2, &data[0][0]);
1847 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1850 TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) {
1851 struct Cmds {
1852 cmds::LoseContextCHROMIUM cmd;
1854 Cmds expected;
1855 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB);
1857 gl_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
1858 GL_GUILTY_CONTEXT_RESET_ARB);
1859 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1861 // TODO: Implement unit test for InsertSyncPointCHROMIUM
1863 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) {
1864 struct Cmds {
1865 cmds::WaitSyncPointCHROMIUM cmd;
1867 Cmds expected;
1868 expected.cmd.Init(1);
1870 gl_->WaitSyncPointCHROMIUM(1);
1871 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1874 TEST_F(GLES2ImplementationTest, DrawBuffersEXT) {
1875 GLenum data[1][1] = {{0}};
1876 struct Cmds {
1877 cmds::DrawBuffersEXTImmediate cmd;
1878 GLenum data[1][1];
1881 Cmds expected;
1882 for (int ii = 0; ii < 1; ++ii) {
1883 for (int jj = 0; jj < 1; ++jj) {
1884 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1887 expected.cmd.Init(1, &data[0][0]);
1888 gl_->DrawBuffersEXT(1, &data[0][0]);
1889 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1892 TEST_F(GLES2ImplementationTest, DiscardBackbufferCHROMIUM) {
1893 struct Cmds {
1894 cmds::DiscardBackbufferCHROMIUM cmd;
1896 Cmds expected;
1897 expected.cmd.Init();
1899 gl_->DiscardBackbufferCHROMIUM();
1900 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1903 TEST_F(GLES2ImplementationTest, MatrixLoadfCHROMIUM) {
1904 GLfloat data[16] = {0};
1905 struct Cmds {
1906 cmds::MatrixLoadfCHROMIUMImmediate cmd;
1907 GLfloat data[16];
1910 for (int jj = 0; jj < 16; ++jj) {
1911 data[jj] = static_cast<GLfloat>(jj);
1913 Cmds expected;
1914 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM, &data[0]);
1915 gl_->MatrixLoadfCHROMIUM(GL_PATH_PROJECTION_CHROMIUM, &data[0]);
1916 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1919 TEST_F(GLES2ImplementationTest, MatrixLoadIdentityCHROMIUM) {
1920 struct Cmds {
1921 cmds::MatrixLoadIdentityCHROMIUM cmd;
1923 Cmds expected;
1924 expected.cmd.Init(GL_PATH_PROJECTION_CHROMIUM);
1926 gl_->MatrixLoadIdentityCHROMIUM(GL_PATH_PROJECTION_CHROMIUM);
1927 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1929 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_