cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_unittest_autogen.h
bloba1ea5873a3683f93562499fc82643ce33079a87b
1 // Copyright (c) 2012 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 // DO NOT EDIT!
9 // This file is included by gles2_implementation.h to declare the
10 // GL api functions.
11 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
12 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_
15 TEST_F(GLES2ImplementationTest, AttachShader) {
16 struct Cmds {
17 cmds::AttachShader cmd;
19 Cmds expected;
20 expected.cmd.Init(1, 2);
22 gl_->AttachShader(1, 2);
23 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
25 // TODO: Implement unit test for BindAttribLocation
27 TEST_F(GLES2ImplementationTest, BindBuffer) {
28 struct Cmds {
29 cmds::BindBuffer cmd;
31 Cmds expected;
32 expected.cmd.Init(GL_ARRAY_BUFFER, 2);
34 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
35 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
36 ClearCommands();
37 gl_->BindBuffer(GL_ARRAY_BUFFER, 2);
38 EXPECT_TRUE(NoCommandsWritten());
41 TEST_F(GLES2ImplementationTest, BindFramebuffer) {
42 struct Cmds {
43 cmds::BindFramebuffer cmd;
45 Cmds expected;
46 expected.cmd.Init(GL_FRAMEBUFFER, 2);
48 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
49 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
50 ClearCommands();
51 gl_->BindFramebuffer(GL_FRAMEBUFFER, 2);
52 EXPECT_TRUE(NoCommandsWritten());
55 TEST_F(GLES2ImplementationTest, BindRenderbuffer) {
56 struct Cmds {
57 cmds::BindRenderbuffer cmd;
59 Cmds expected;
60 expected.cmd.Init(GL_RENDERBUFFER, 2);
62 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
63 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
64 ClearCommands();
65 gl_->BindRenderbuffer(GL_RENDERBUFFER, 2);
66 EXPECT_TRUE(NoCommandsWritten());
69 TEST_F(GLES2ImplementationTest, BlendColor) {
70 struct Cmds {
71 cmds::BlendColor cmd;
73 Cmds expected;
74 expected.cmd.Init(1, 2, 3, 4);
76 gl_->BlendColor(1, 2, 3, 4);
77 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
80 TEST_F(GLES2ImplementationTest, BlendEquation) {
81 struct Cmds {
82 cmds::BlendEquation cmd;
84 Cmds expected;
85 expected.cmd.Init(GL_FUNC_SUBTRACT);
87 gl_->BlendEquation(GL_FUNC_SUBTRACT);
88 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
91 TEST_F(GLES2ImplementationTest, BlendEquationSeparate) {
92 struct Cmds {
93 cmds::BlendEquationSeparate cmd;
95 Cmds expected;
96 expected.cmd.Init(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
98 gl_->BlendEquationSeparate(GL_FUNC_SUBTRACT, GL_FUNC_ADD);
99 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
102 TEST_F(GLES2ImplementationTest, BlendFunc) {
103 struct Cmds {
104 cmds::BlendFunc cmd;
106 Cmds expected;
107 expected.cmd.Init(GL_ZERO, GL_ZERO);
109 gl_->BlendFunc(GL_ZERO, GL_ZERO);
110 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
113 TEST_F(GLES2ImplementationTest, BlendFuncSeparate) {
114 struct Cmds {
115 cmds::BlendFuncSeparate cmd;
117 Cmds expected;
118 expected.cmd.Init(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
120 gl_->BlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO);
121 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
124 TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) {
125 struct Cmds {
126 cmds::CheckFramebufferStatus cmd;
129 typedef cmds::CheckFramebufferStatus::Result Result;
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(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(1);
173 gl_->ClearDepthf(1);
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, 0);
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, CopyTexSubImage2D) {
224 struct Cmds {
225 cmds::CopyTexSubImage2D cmd;
227 Cmds expected;
228 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
230 gl_->CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
231 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
234 TEST_F(GLES2ImplementationTest, CullFace) {
235 struct Cmds {
236 cmds::CullFace cmd;
238 Cmds expected;
239 expected.cmd.Init(GL_FRONT);
241 gl_->CullFace(GL_FRONT);
242 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
245 TEST_F(GLES2ImplementationTest, DeleteBuffers) {
246 GLuint ids[2] = { kBuffersStartId, kBuffersStartId + 1 };
247 struct Cmds {
248 cmds::DeleteBuffersImmediate del;
249 GLuint data[2];
251 Cmds expected;
252 expected.del.Init(arraysize(ids), &ids[0]);
253 expected.data[0] = kBuffersStartId;
254 expected.data[1] = kBuffersStartId + 1;
255 gl_->DeleteBuffers(arraysize(ids), &ids[0]);
256 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
259 TEST_F(GLES2ImplementationTest, DeleteFramebuffers) {
260 GLuint ids[2] = { kFramebuffersStartId, kFramebuffersStartId + 1 };
261 struct Cmds {
262 cmds::DeleteFramebuffersImmediate del;
263 GLuint data[2];
265 Cmds expected;
266 expected.del.Init(arraysize(ids), &ids[0]);
267 expected.data[0] = kFramebuffersStartId;
268 expected.data[1] = kFramebuffersStartId + 1;
269 gl_->DeleteFramebuffers(arraysize(ids), &ids[0]);
270 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
273 TEST_F(GLES2ImplementationTest, DeleteProgram) {
274 struct Cmds {
275 cmds::DeleteProgram cmd;
277 Cmds expected;
278 expected.cmd.Init(1);
280 gl_->DeleteProgram(1);
281 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
284 TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) {
285 GLuint ids[2] = { kRenderbuffersStartId, kRenderbuffersStartId + 1 };
286 struct Cmds {
287 cmds::DeleteRenderbuffersImmediate del;
288 GLuint data[2];
290 Cmds expected;
291 expected.del.Init(arraysize(ids), &ids[0]);
292 expected.data[0] = kRenderbuffersStartId;
293 expected.data[1] = kRenderbuffersStartId + 1;
294 gl_->DeleteRenderbuffers(arraysize(ids), &ids[0]);
295 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
298 TEST_F(GLES2ImplementationTest, DeleteShader) {
299 struct Cmds {
300 cmds::DeleteShader cmd;
302 Cmds expected;
303 expected.cmd.Init(1);
305 gl_->DeleteShader(1);
306 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
309 TEST_F(GLES2ImplementationTest, DeleteTextures) {
310 GLuint ids[2] = { kTexturesStartId, kTexturesStartId + 1 };
311 struct Cmds {
312 cmds::DeleteTexturesImmediate del;
313 GLuint data[2];
315 Cmds expected;
316 expected.del.Init(arraysize(ids), &ids[0]);
317 expected.data[0] = kTexturesStartId;
318 expected.data[1] = kTexturesStartId + 1;
319 gl_->DeleteTextures(arraysize(ids), &ids[0]);
320 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
323 TEST_F(GLES2ImplementationTest, DepthFunc) {
324 struct Cmds {
325 cmds::DepthFunc cmd;
327 Cmds expected;
328 expected.cmd.Init(GL_NEVER);
330 gl_->DepthFunc(GL_NEVER);
331 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
334 TEST_F(GLES2ImplementationTest, DepthMask) {
335 struct Cmds {
336 cmds::DepthMask cmd;
338 Cmds expected;
339 expected.cmd.Init(true);
341 gl_->DepthMask(true);
342 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
345 TEST_F(GLES2ImplementationTest, DepthRangef) {
346 struct Cmds {
347 cmds::DepthRangef cmd;
349 Cmds expected;
350 expected.cmd.Init(1, 2);
352 gl_->DepthRangef(1, 2);
353 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
356 TEST_F(GLES2ImplementationTest, DetachShader) {
357 struct Cmds {
358 cmds::DetachShader cmd;
360 Cmds expected;
361 expected.cmd.Init(1, 2);
363 gl_->DetachShader(1, 2);
364 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
367 TEST_F(GLES2ImplementationTest, DisableVertexAttribArray) {
368 struct Cmds {
369 cmds::DisableVertexAttribArray cmd;
371 Cmds expected;
372 expected.cmd.Init(1);
374 gl_->DisableVertexAttribArray(1);
375 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
378 TEST_F(GLES2ImplementationTest, DrawArrays) {
379 struct Cmds {
380 cmds::DrawArrays cmd;
382 Cmds expected;
383 expected.cmd.Init(GL_POINTS, 2, 3);
385 gl_->DrawArrays(GL_POINTS, 2, 3);
386 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
389 TEST_F(GLES2ImplementationTest, EnableVertexAttribArray) {
390 struct Cmds {
391 cmds::EnableVertexAttribArray cmd;
393 Cmds expected;
394 expected.cmd.Init(1);
396 gl_->EnableVertexAttribArray(1);
397 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
400 TEST_F(GLES2ImplementationTest, Flush) {
401 struct Cmds {
402 cmds::Flush cmd;
404 Cmds expected;
405 expected.cmd.Init();
407 gl_->Flush();
408 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
411 TEST_F(GLES2ImplementationTest, FramebufferRenderbuffer) {
412 struct Cmds {
413 cmds::FramebufferRenderbuffer cmd;
415 Cmds expected;
416 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4);
418 gl_->FramebufferRenderbuffer(
419 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 4);
420 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
423 TEST_F(GLES2ImplementationTest, FramebufferTexture2D) {
424 struct Cmds {
425 cmds::FramebufferTexture2D cmd;
427 Cmds expected;
428 expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0);
430 gl_->FramebufferTexture2D(
431 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0);
432 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
435 TEST_F(GLES2ImplementationTest, FrontFace) {
436 struct Cmds {
437 cmds::FrontFace cmd;
439 Cmds expected;
440 expected.cmd.Init(GL_CW);
442 gl_->FrontFace(GL_CW);
443 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
446 TEST_F(GLES2ImplementationTest, GenBuffers) {
447 GLuint ids[2] = { 0, };
448 struct Cmds {
449 cmds::GenBuffersImmediate gen;
450 GLuint data[2];
452 Cmds expected;
453 expected.gen.Init(arraysize(ids), &ids[0]);
454 expected.data[0] = kBuffersStartId;
455 expected.data[1] = kBuffersStartId + 1;
456 gl_->GenBuffers(arraysize(ids), &ids[0]);
457 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
458 EXPECT_EQ(kBuffersStartId, ids[0]);
459 EXPECT_EQ(kBuffersStartId + 1, ids[1]);
462 TEST_F(GLES2ImplementationTest, GenerateMipmap) {
463 struct Cmds {
464 cmds::GenerateMipmap cmd;
466 Cmds expected;
467 expected.cmd.Init(GL_TEXTURE_2D);
469 gl_->GenerateMipmap(GL_TEXTURE_2D);
470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
473 TEST_F(GLES2ImplementationTest, GenFramebuffers) {
474 GLuint ids[2] = { 0, };
475 struct Cmds {
476 cmds::GenFramebuffersImmediate gen;
477 GLuint data[2];
479 Cmds expected;
480 expected.gen.Init(arraysize(ids), &ids[0]);
481 expected.data[0] = kFramebuffersStartId;
482 expected.data[1] = kFramebuffersStartId + 1;
483 gl_->GenFramebuffers(arraysize(ids), &ids[0]);
484 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
485 EXPECT_EQ(kFramebuffersStartId, ids[0]);
486 EXPECT_EQ(kFramebuffersStartId + 1, ids[1]);
489 TEST_F(GLES2ImplementationTest, GenRenderbuffers) {
490 GLuint ids[2] = { 0, };
491 struct Cmds {
492 cmds::GenRenderbuffersImmediate gen;
493 GLuint data[2];
495 Cmds expected;
496 expected.gen.Init(arraysize(ids), &ids[0]);
497 expected.data[0] = kRenderbuffersStartId;
498 expected.data[1] = kRenderbuffersStartId + 1;
499 gl_->GenRenderbuffers(arraysize(ids), &ids[0]);
500 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
501 EXPECT_EQ(kRenderbuffersStartId, ids[0]);
502 EXPECT_EQ(kRenderbuffersStartId + 1, ids[1]);
505 TEST_F(GLES2ImplementationTest, GenTextures) {
506 GLuint ids[2] = { 0, };
507 struct Cmds {
508 cmds::GenTexturesImmediate gen;
509 GLuint data[2];
511 Cmds expected;
512 expected.gen.Init(arraysize(ids), &ids[0]);
513 expected.data[0] = kTexturesStartId;
514 expected.data[1] = kTexturesStartId + 1;
515 gl_->GenTextures(arraysize(ids), &ids[0]);
516 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
517 EXPECT_EQ(kTexturesStartId, ids[0]);
518 EXPECT_EQ(kTexturesStartId + 1, ids[1]);
520 // TODO: Implement unit test for GetActiveAttrib
521 // TODO: Implement unit test for GetActiveUniform
522 // TODO: Implement unit test for GetAttachedShaders
523 // TODO: Implement unit test for GetAttribLocation
525 TEST_F(GLES2ImplementationTest, GetBooleanv) {
526 struct Cmds {
527 cmds::GetBooleanv cmd;
529 typedef cmds::GetBooleanv::Result Result;
530 Result::Type result = 0;
531 Cmds expected;
532 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
533 expected.cmd.Init(123, result1.id, result1.offset);
534 EXPECT_CALL(*command_buffer(), OnFlush())
535 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
536 .RetiresOnSaturation();
537 gl_->GetBooleanv(123, &result);
538 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
539 EXPECT_EQ(static_cast<Result::Type>(1), result);
542 TEST_F(GLES2ImplementationTest, GetBufferParameteriv) {
543 struct Cmds {
544 cmds::GetBufferParameteriv cmd;
546 typedef cmds::GetBufferParameteriv::Result Result;
547 Result::Type result = 0;
548 Cmds expected;
549 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
550 expected.cmd.Init(123, GL_BUFFER_SIZE, result1.id, result1.offset);
551 EXPECT_CALL(*command_buffer(), OnFlush())
552 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
553 .RetiresOnSaturation();
554 gl_->GetBufferParameteriv(123, GL_BUFFER_SIZE, &result);
555 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
556 EXPECT_EQ(static_cast<Result::Type>(1), result);
559 TEST_F(GLES2ImplementationTest, GetFloatv) {
560 struct Cmds {
561 cmds::GetFloatv cmd;
563 typedef cmds::GetFloatv::Result Result;
564 Result::Type result = 0;
565 Cmds expected;
566 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
567 expected.cmd.Init(123, result1.id, result1.offset);
568 EXPECT_CALL(*command_buffer(), OnFlush())
569 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
570 .RetiresOnSaturation();
571 gl_->GetFloatv(123, &result);
572 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
573 EXPECT_EQ(static_cast<Result::Type>(1), result);
576 TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) {
577 struct Cmds {
578 cmds::GetFramebufferAttachmentParameteriv cmd;
580 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
581 Result::Type result = 0;
582 Cmds expected;
583 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
584 expected.cmd.Init(
585 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
586 result1.id, result1.offset);
587 EXPECT_CALL(*command_buffer(), OnFlush())
588 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
589 .RetiresOnSaturation();
590 gl_->GetFramebufferAttachmentParameteriv(
591 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE,
592 &result);
593 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
594 EXPECT_EQ(static_cast<Result::Type>(1), result);
597 TEST_F(GLES2ImplementationTest, GetIntegerv) {
598 struct Cmds {
599 cmds::GetIntegerv cmd;
601 typedef cmds::GetIntegerv::Result Result;
602 Result::Type result = 0;
603 Cmds expected;
604 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
605 expected.cmd.Init(123, result1.id, result1.offset);
606 EXPECT_CALL(*command_buffer(), OnFlush())
607 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
608 .RetiresOnSaturation();
609 gl_->GetIntegerv(123, &result);
610 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
611 EXPECT_EQ(static_cast<Result::Type>(1), result);
614 TEST_F(GLES2ImplementationTest, GetProgramiv) {
615 struct Cmds {
616 cmds::GetProgramiv cmd;
618 typedef cmds::GetProgramiv::Result Result;
619 Result::Type result = 0;
620 Cmds expected;
621 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
622 expected.cmd.Init(123, GL_DELETE_STATUS, result1.id, result1.offset);
623 EXPECT_CALL(*command_buffer(), OnFlush())
624 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
625 .RetiresOnSaturation();
626 gl_->GetProgramiv(123, GL_DELETE_STATUS, &result);
627 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
628 EXPECT_EQ(static_cast<Result::Type>(1), result);
630 // TODO: Implement unit test for GetProgramInfoLog
632 TEST_F(GLES2ImplementationTest, GetRenderbufferParameteriv) {
633 struct Cmds {
634 cmds::GetRenderbufferParameteriv cmd;
636 typedef cmds::GetRenderbufferParameteriv::Result Result;
637 Result::Type result = 0;
638 Cmds expected;
639 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
640 expected.cmd.Init(123, GL_RENDERBUFFER_RED_SIZE, result1.id, result1.offset);
641 EXPECT_CALL(*command_buffer(), OnFlush())
642 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
643 .RetiresOnSaturation();
644 gl_->GetRenderbufferParameteriv(123, GL_RENDERBUFFER_RED_SIZE, &result);
645 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
646 EXPECT_EQ(static_cast<Result::Type>(1), result);
649 TEST_F(GLES2ImplementationTest, GetShaderiv) {
650 struct Cmds {
651 cmds::GetShaderiv cmd;
653 typedef cmds::GetShaderiv::Result Result;
654 Result::Type result = 0;
655 Cmds expected;
656 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
657 expected.cmd.Init(123, GL_SHADER_TYPE, result1.id, result1.offset);
658 EXPECT_CALL(*command_buffer(), OnFlush())
659 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
660 .RetiresOnSaturation();
661 gl_->GetShaderiv(123, GL_SHADER_TYPE, &result);
662 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
663 EXPECT_EQ(static_cast<Result::Type>(1), result);
665 // TODO: Implement unit test for GetShaderInfoLog
666 // TODO: Implement unit test for GetShaderPrecisionFormat
668 TEST_F(GLES2ImplementationTest, GetTexParameterfv) {
669 struct Cmds {
670 cmds::GetTexParameterfv cmd;
672 typedef cmds::GetTexParameterfv::Result Result;
673 Result::Type result = 0;
674 Cmds expected;
675 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
676 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
677 EXPECT_CALL(*command_buffer(), OnFlush())
678 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
679 .RetiresOnSaturation();
680 gl_->GetTexParameterfv(123, GL_TEXTURE_MAG_FILTER, &result);
681 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
682 EXPECT_EQ(static_cast<Result::Type>(1), result);
685 TEST_F(GLES2ImplementationTest, GetTexParameteriv) {
686 struct Cmds {
687 cmds::GetTexParameteriv cmd;
689 typedef cmds::GetTexParameteriv::Result Result;
690 Result::Type result = 0;
691 Cmds expected;
692 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
693 expected.cmd.Init(123, GL_TEXTURE_MAG_FILTER, result1.id, result1.offset);
694 EXPECT_CALL(*command_buffer(), OnFlush())
695 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
696 .RetiresOnSaturation();
697 gl_->GetTexParameteriv(123, GL_TEXTURE_MAG_FILTER, &result);
698 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
699 EXPECT_EQ(static_cast<Result::Type>(1), result);
701 // TODO: Implement unit test for GetUniformfv
702 // TODO: Implement unit test for GetUniformiv
703 // TODO: Implement unit test for GetUniformLocation
705 TEST_F(GLES2ImplementationTest, GetVertexAttribfv) {
706 struct Cmds {
707 cmds::GetVertexAttribfv cmd;
709 typedef cmds::GetVertexAttribfv::Result Result;
710 Result::Type result = 0;
711 Cmds expected;
712 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
713 expected.cmd.Init(
714 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset);
715 EXPECT_CALL(*command_buffer(), OnFlush())
716 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
717 .RetiresOnSaturation();
718 gl_->GetVertexAttribfv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
719 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
720 EXPECT_EQ(static_cast<Result::Type>(1), result);
723 TEST_F(GLES2ImplementationTest, GetVertexAttribiv) {
724 struct Cmds {
725 cmds::GetVertexAttribiv cmd;
727 typedef cmds::GetVertexAttribiv::Result Result;
728 Result::Type result = 0;
729 Cmds expected;
730 ExpectedMemoryInfo result1 = GetExpectedResultMemory(4);
731 expected.cmd.Init(
732 123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, result1.id, result1.offset);
733 EXPECT_CALL(*command_buffer(), OnFlush())
734 .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1)))
735 .RetiresOnSaturation();
736 gl_->GetVertexAttribiv(123, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &result);
737 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
738 EXPECT_EQ(static_cast<Result::Type>(1), result);
741 TEST_F(GLES2ImplementationTest, Hint) {
742 struct Cmds {
743 cmds::Hint cmd;
745 Cmds expected;
746 expected.cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
748 gl_->Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST);
749 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
752 TEST_F(GLES2ImplementationTest, IsBuffer) {
753 struct Cmds {
754 cmds::IsBuffer cmd;
757 typedef cmds::IsBuffer::Result Result;
758 Cmds expected;
759 ExpectedMemoryInfo result1 =
760 GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result));
761 expected.cmd.Init(1, result1.id, result1.offset);
763 EXPECT_CALL(*command_buffer(), OnFlush())
764 .WillOnce(SetMemory(result1.ptr, uint32(1)))
765 .RetiresOnSaturation();
767 GLboolean result = gl_->IsBuffer(1);
768 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
769 EXPECT_TRUE(result);
772 TEST_F(GLES2ImplementationTest, IsEnabled) {
773 struct Cmds {
774 cmds::IsEnabled cmd;
777 typedef cmds::IsEnabled::Result Result;
778 Cmds expected;
779 ExpectedMemoryInfo result1 =
780 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result));
781 expected.cmd.Init(1, result1.id, result1.offset);
783 EXPECT_CALL(*command_buffer(), OnFlush())
784 .WillOnce(SetMemory(result1.ptr, uint32(1)))
785 .RetiresOnSaturation();
787 GLboolean result = gl_->IsEnabled(1);
788 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
789 EXPECT_TRUE(result);
792 TEST_F(GLES2ImplementationTest, IsFramebuffer) {
793 struct Cmds {
794 cmds::IsFramebuffer cmd;
797 typedef cmds::IsFramebuffer::Result Result;
798 Cmds expected;
799 ExpectedMemoryInfo result1 =
800 GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result));
801 expected.cmd.Init(1, result1.id, result1.offset);
803 EXPECT_CALL(*command_buffer(), OnFlush())
804 .WillOnce(SetMemory(result1.ptr, uint32(1)))
805 .RetiresOnSaturation();
807 GLboolean result = gl_->IsFramebuffer(1);
808 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
809 EXPECT_TRUE(result);
812 TEST_F(GLES2ImplementationTest, IsProgram) {
813 struct Cmds {
814 cmds::IsProgram cmd;
817 typedef cmds::IsProgram::Result Result;
818 Cmds expected;
819 ExpectedMemoryInfo result1 =
820 GetExpectedResultMemory(sizeof(cmds::IsProgram::Result));
821 expected.cmd.Init(1, result1.id, result1.offset);
823 EXPECT_CALL(*command_buffer(), OnFlush())
824 .WillOnce(SetMemory(result1.ptr, uint32(1)))
825 .RetiresOnSaturation();
827 GLboolean result = gl_->IsProgram(1);
828 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
829 EXPECT_TRUE(result);
832 TEST_F(GLES2ImplementationTest, IsRenderbuffer) {
833 struct Cmds {
834 cmds::IsRenderbuffer cmd;
837 typedef cmds::IsRenderbuffer::Result Result;
838 Cmds expected;
839 ExpectedMemoryInfo result1 =
840 GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result));
841 expected.cmd.Init(1, result1.id, result1.offset);
843 EXPECT_CALL(*command_buffer(), OnFlush())
844 .WillOnce(SetMemory(result1.ptr, uint32(1)))
845 .RetiresOnSaturation();
847 GLboolean result = gl_->IsRenderbuffer(1);
848 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
849 EXPECT_TRUE(result);
852 TEST_F(GLES2ImplementationTest, IsShader) {
853 struct Cmds {
854 cmds::IsShader cmd;
857 typedef cmds::IsShader::Result Result;
858 Cmds expected;
859 ExpectedMemoryInfo result1 =
860 GetExpectedResultMemory(sizeof(cmds::IsShader::Result));
861 expected.cmd.Init(1, result1.id, result1.offset);
863 EXPECT_CALL(*command_buffer(), OnFlush())
864 .WillOnce(SetMemory(result1.ptr, uint32(1)))
865 .RetiresOnSaturation();
867 GLboolean result = gl_->IsShader(1);
868 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
869 EXPECT_TRUE(result);
872 TEST_F(GLES2ImplementationTest, IsTexture) {
873 struct Cmds {
874 cmds::IsTexture cmd;
877 typedef cmds::IsTexture::Result Result;
878 Cmds expected;
879 ExpectedMemoryInfo result1 =
880 GetExpectedResultMemory(sizeof(cmds::IsTexture::Result));
881 expected.cmd.Init(1, result1.id, result1.offset);
883 EXPECT_CALL(*command_buffer(), OnFlush())
884 .WillOnce(SetMemory(result1.ptr, uint32(1)))
885 .RetiresOnSaturation();
887 GLboolean result = gl_->IsTexture(1);
888 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
889 EXPECT_TRUE(result);
892 TEST_F(GLES2ImplementationTest, LineWidth) {
893 struct Cmds {
894 cmds::LineWidth cmd;
896 Cmds expected;
897 expected.cmd.Init(1);
899 gl_->LineWidth(1);
900 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
903 TEST_F(GLES2ImplementationTest, LinkProgram) {
904 struct Cmds {
905 cmds::LinkProgram cmd;
907 Cmds expected;
908 expected.cmd.Init(1);
910 gl_->LinkProgram(1);
911 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
914 TEST_F(GLES2ImplementationTest, PixelStorei) {
915 struct Cmds {
916 cmds::PixelStorei cmd;
918 Cmds expected;
919 expected.cmd.Init(GL_PACK_ALIGNMENT, 1);
921 gl_->PixelStorei(GL_PACK_ALIGNMENT, 1);
922 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
925 TEST_F(GLES2ImplementationTest, PolygonOffset) {
926 struct Cmds {
927 cmds::PolygonOffset cmd;
929 Cmds expected;
930 expected.cmd.Init(1, 2);
932 gl_->PolygonOffset(1, 2);
933 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
936 TEST_F(GLES2ImplementationTest, ReleaseShaderCompiler) {
937 struct Cmds {
938 cmds::ReleaseShaderCompiler cmd;
940 Cmds expected;
941 expected.cmd.Init();
943 gl_->ReleaseShaderCompiler();
944 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
947 TEST_F(GLES2ImplementationTest, RenderbufferStorage) {
948 struct Cmds {
949 cmds::RenderbufferStorage cmd;
951 Cmds expected;
952 expected.cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
954 gl_->RenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 3, 4);
955 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
958 TEST_F(GLES2ImplementationTest, SampleCoverage) {
959 struct Cmds {
960 cmds::SampleCoverage cmd;
962 Cmds expected;
963 expected.cmd.Init(1, true);
965 gl_->SampleCoverage(1, true);
966 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
969 TEST_F(GLES2ImplementationTest, Scissor) {
970 struct Cmds {
971 cmds::Scissor cmd;
973 Cmds expected;
974 expected.cmd.Init(1, 2, 3, 4);
976 gl_->Scissor(1, 2, 3, 4);
977 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
980 TEST_F(GLES2ImplementationTest, StencilFunc) {
981 struct Cmds {
982 cmds::StencilFunc cmd;
984 Cmds expected;
985 expected.cmd.Init(GL_NEVER, 2, 3);
987 gl_->StencilFunc(GL_NEVER, 2, 3);
988 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
991 TEST_F(GLES2ImplementationTest, StencilFuncSeparate) {
992 struct Cmds {
993 cmds::StencilFuncSeparate cmd;
995 Cmds expected;
996 expected.cmd.Init(GL_FRONT, GL_NEVER, 3, 4);
998 gl_->StencilFuncSeparate(GL_FRONT, GL_NEVER, 3, 4);
999 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1002 TEST_F(GLES2ImplementationTest, StencilMask) {
1003 struct Cmds {
1004 cmds::StencilMask cmd;
1006 Cmds expected;
1007 expected.cmd.Init(1);
1009 gl_->StencilMask(1);
1010 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1013 TEST_F(GLES2ImplementationTest, StencilMaskSeparate) {
1014 struct Cmds {
1015 cmds::StencilMaskSeparate cmd;
1017 Cmds expected;
1018 expected.cmd.Init(GL_FRONT, 2);
1020 gl_->StencilMaskSeparate(GL_FRONT, 2);
1021 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1024 TEST_F(GLES2ImplementationTest, StencilOp) {
1025 struct Cmds {
1026 cmds::StencilOp cmd;
1028 Cmds expected;
1029 expected.cmd.Init(GL_KEEP, GL_INCR, GL_KEEP);
1031 gl_->StencilOp(GL_KEEP, GL_INCR, GL_KEEP);
1032 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1035 TEST_F(GLES2ImplementationTest, StencilOpSeparate) {
1036 struct Cmds {
1037 cmds::StencilOpSeparate cmd;
1039 Cmds expected;
1040 expected.cmd.Init(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1042 gl_->StencilOpSeparate(GL_FRONT, GL_INCR, GL_KEEP, GL_KEEP);
1043 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1046 TEST_F(GLES2ImplementationTest, TexParameterf) {
1047 struct Cmds {
1048 cmds::TexParameterf cmd;
1050 Cmds expected;
1051 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3);
1053 gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3);
1054 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1057 TEST_F(GLES2ImplementationTest, TexParameterfv) {
1058 GLfloat data[1] = {0};
1059 struct Cmds {
1060 cmds::TexParameterfvImmediate cmd;
1061 GLfloat data[1];
1064 for (int jj = 0; jj < 1; ++jj) {
1065 data[jj] = static_cast<GLfloat>(jj);
1067 Cmds expected;
1068 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1069 gl_->TexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1070 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1073 TEST_F(GLES2ImplementationTest, TexParameteri) {
1074 struct Cmds {
1075 cmds::TexParameteri cmd;
1077 Cmds expected;
1078 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3);
1080 gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3);
1081 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1084 TEST_F(GLES2ImplementationTest, TexParameteriv) {
1085 GLint data[1] = {0};
1086 struct Cmds {
1087 cmds::TexParameterivImmediate cmd;
1088 GLint data[1];
1091 for (int jj = 0; jj < 1; ++jj) {
1092 data[jj] = static_cast<GLint>(jj);
1094 Cmds expected;
1095 expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1096 gl_->TexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &data[0]);
1097 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1100 TEST_F(GLES2ImplementationTest, Uniform1f) {
1101 struct Cmds {
1102 cmds::Uniform1f cmd;
1104 Cmds expected;
1105 expected.cmd.Init(1, 2);
1107 gl_->Uniform1f(1, 2);
1108 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1111 TEST_F(GLES2ImplementationTest, Uniform1fv) {
1112 GLfloat data[2][1] = {{0}};
1113 struct Cmds {
1114 cmds::Uniform1fvImmediate cmd;
1115 GLfloat data[2][1];
1118 Cmds expected;
1119 for (int ii = 0; ii < 2; ++ii) {
1120 for (int jj = 0; jj < 1; ++jj) {
1121 data[ii][jj] = static_cast<GLfloat>(ii * 1 + jj);
1124 expected.cmd.Init(1, 2, &data[0][0]);
1125 gl_->Uniform1fv(1, 2, &data[0][0]);
1126 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1129 TEST_F(GLES2ImplementationTest, Uniform1i) {
1130 struct Cmds {
1131 cmds::Uniform1i cmd;
1133 Cmds expected;
1134 expected.cmd.Init(1, 2);
1136 gl_->Uniform1i(1, 2);
1137 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1140 TEST_F(GLES2ImplementationTest, Uniform1iv) {
1141 GLint data[2][1] = {{0}};
1142 struct Cmds {
1143 cmds::Uniform1ivImmediate cmd;
1144 GLint data[2][1];
1147 Cmds expected;
1148 for (int ii = 0; ii < 2; ++ii) {
1149 for (int jj = 0; jj < 1; ++jj) {
1150 data[ii][jj] = static_cast<GLint>(ii * 1 + jj);
1153 expected.cmd.Init(1, 2, &data[0][0]);
1154 gl_->Uniform1iv(1, 2, &data[0][0]);
1155 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1158 TEST_F(GLES2ImplementationTest, Uniform2f) {
1159 struct Cmds {
1160 cmds::Uniform2f cmd;
1162 Cmds expected;
1163 expected.cmd.Init(1, 2, 3);
1165 gl_->Uniform2f(1, 2, 3);
1166 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1169 TEST_F(GLES2ImplementationTest, Uniform2fv) {
1170 GLfloat data[2][2] = {{0}};
1171 struct Cmds {
1172 cmds::Uniform2fvImmediate cmd;
1173 GLfloat data[2][2];
1176 Cmds expected;
1177 for (int ii = 0; ii < 2; ++ii) {
1178 for (int jj = 0; jj < 2; ++jj) {
1179 data[ii][jj] = static_cast<GLfloat>(ii * 2 + jj);
1182 expected.cmd.Init(1, 2, &data[0][0]);
1183 gl_->Uniform2fv(1, 2, &data[0][0]);
1184 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1187 TEST_F(GLES2ImplementationTest, Uniform2i) {
1188 struct Cmds {
1189 cmds::Uniform2i cmd;
1191 Cmds expected;
1192 expected.cmd.Init(1, 2, 3);
1194 gl_->Uniform2i(1, 2, 3);
1195 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1198 TEST_F(GLES2ImplementationTest, Uniform2iv) {
1199 GLint data[2][2] = {{0}};
1200 struct Cmds {
1201 cmds::Uniform2ivImmediate cmd;
1202 GLint data[2][2];
1205 Cmds expected;
1206 for (int ii = 0; ii < 2; ++ii) {
1207 for (int jj = 0; jj < 2; ++jj) {
1208 data[ii][jj] = static_cast<GLint>(ii * 2 + jj);
1211 expected.cmd.Init(1, 2, &data[0][0]);
1212 gl_->Uniform2iv(1, 2, &data[0][0]);
1213 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1216 TEST_F(GLES2ImplementationTest, Uniform3f) {
1217 struct Cmds {
1218 cmds::Uniform3f cmd;
1220 Cmds expected;
1221 expected.cmd.Init(1, 2, 3, 4);
1223 gl_->Uniform3f(1, 2, 3, 4);
1224 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1227 TEST_F(GLES2ImplementationTest, Uniform3fv) {
1228 GLfloat data[2][3] = {{0}};
1229 struct Cmds {
1230 cmds::Uniform3fvImmediate cmd;
1231 GLfloat data[2][3];
1234 Cmds expected;
1235 for (int ii = 0; ii < 2; ++ii) {
1236 for (int jj = 0; jj < 3; ++jj) {
1237 data[ii][jj] = static_cast<GLfloat>(ii * 3 + jj);
1240 expected.cmd.Init(1, 2, &data[0][0]);
1241 gl_->Uniform3fv(1, 2, &data[0][0]);
1242 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1245 TEST_F(GLES2ImplementationTest, Uniform3i) {
1246 struct Cmds {
1247 cmds::Uniform3i cmd;
1249 Cmds expected;
1250 expected.cmd.Init(1, 2, 3, 4);
1252 gl_->Uniform3i(1, 2, 3, 4);
1253 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1256 TEST_F(GLES2ImplementationTest, Uniform3iv) {
1257 GLint data[2][3] = {{0}};
1258 struct Cmds {
1259 cmds::Uniform3ivImmediate cmd;
1260 GLint data[2][3];
1263 Cmds expected;
1264 for (int ii = 0; ii < 2; ++ii) {
1265 for (int jj = 0; jj < 3; ++jj) {
1266 data[ii][jj] = static_cast<GLint>(ii * 3 + jj);
1269 expected.cmd.Init(1, 2, &data[0][0]);
1270 gl_->Uniform3iv(1, 2, &data[0][0]);
1271 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1274 TEST_F(GLES2ImplementationTest, Uniform4f) {
1275 struct Cmds {
1276 cmds::Uniform4f cmd;
1278 Cmds expected;
1279 expected.cmd.Init(1, 2, 3, 4, 5);
1281 gl_->Uniform4f(1, 2, 3, 4, 5);
1282 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1285 TEST_F(GLES2ImplementationTest, Uniform4fv) {
1286 GLfloat data[2][4] = {{0}};
1287 struct Cmds {
1288 cmds::Uniform4fvImmediate cmd;
1289 GLfloat data[2][4];
1292 Cmds expected;
1293 for (int ii = 0; ii < 2; ++ii) {
1294 for (int jj = 0; jj < 4; ++jj) {
1295 data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj);
1298 expected.cmd.Init(1, 2, &data[0][0]);
1299 gl_->Uniform4fv(1, 2, &data[0][0]);
1300 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1303 TEST_F(GLES2ImplementationTest, Uniform4i) {
1304 struct Cmds {
1305 cmds::Uniform4i cmd;
1307 Cmds expected;
1308 expected.cmd.Init(1, 2, 3, 4, 5);
1310 gl_->Uniform4i(1, 2, 3, 4, 5);
1311 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1314 TEST_F(GLES2ImplementationTest, Uniform4iv) {
1315 GLint data[2][4] = {{0}};
1316 struct Cmds {
1317 cmds::Uniform4ivImmediate cmd;
1318 GLint data[2][4];
1321 Cmds expected;
1322 for (int ii = 0; ii < 2; ++ii) {
1323 for (int jj = 0; jj < 4; ++jj) {
1324 data[ii][jj] = static_cast<GLint>(ii * 4 + jj);
1327 expected.cmd.Init(1, 2, &data[0][0]);
1328 gl_->Uniform4iv(1, 2, &data[0][0]);
1329 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1332 TEST_F(GLES2ImplementationTest, UniformMatrix2fv) {
1333 GLfloat data[2][4] = {{0}};
1334 struct Cmds {
1335 cmds::UniformMatrix2fvImmediate cmd;
1336 GLfloat 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<GLfloat>(ii * 4 + jj);
1345 expected.cmd.Init(1, 2, false, &data[0][0]);
1346 gl_->UniformMatrix2fv(1, 2, false, &data[0][0]);
1347 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1350 TEST_F(GLES2ImplementationTest, UniformMatrix3fv) {
1351 GLfloat data[2][9] = {{0}};
1352 struct Cmds {
1353 cmds::UniformMatrix3fvImmediate cmd;
1354 GLfloat data[2][9];
1357 Cmds expected;
1358 for (int ii = 0; ii < 2; ++ii) {
1359 for (int jj = 0; jj < 9; ++jj) {
1360 data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj);
1363 expected.cmd.Init(1, 2, false, &data[0][0]);
1364 gl_->UniformMatrix3fv(1, 2, false, &data[0][0]);
1365 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1368 TEST_F(GLES2ImplementationTest, UniformMatrix4fv) {
1369 GLfloat data[2][16] = {{0}};
1370 struct Cmds {
1371 cmds::UniformMatrix4fvImmediate cmd;
1372 GLfloat data[2][16];
1375 Cmds expected;
1376 for (int ii = 0; ii < 2; ++ii) {
1377 for (int jj = 0; jj < 16; ++jj) {
1378 data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj);
1381 expected.cmd.Init(1, 2, false, &data[0][0]);
1382 gl_->UniformMatrix4fv(1, 2, false, &data[0][0]);
1383 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1386 TEST_F(GLES2ImplementationTest, UseProgram) {
1387 struct Cmds {
1388 cmds::UseProgram cmd;
1390 Cmds expected;
1391 expected.cmd.Init(1);
1393 gl_->UseProgram(1);
1394 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1397 TEST_F(GLES2ImplementationTest, ValidateProgram) {
1398 struct Cmds {
1399 cmds::ValidateProgram cmd;
1401 Cmds expected;
1402 expected.cmd.Init(1);
1404 gl_->ValidateProgram(1);
1405 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1408 TEST_F(GLES2ImplementationTest, VertexAttrib1f) {
1409 struct Cmds {
1410 cmds::VertexAttrib1f cmd;
1412 Cmds expected;
1413 expected.cmd.Init(1, 2);
1415 gl_->VertexAttrib1f(1, 2);
1416 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1419 TEST_F(GLES2ImplementationTest, VertexAttrib1fv) {
1420 GLfloat data[1] = {0};
1421 struct Cmds {
1422 cmds::VertexAttrib1fvImmediate cmd;
1423 GLfloat data[1];
1426 for (int jj = 0; jj < 1; ++jj) {
1427 data[jj] = static_cast<GLfloat>(jj);
1429 Cmds expected;
1430 expected.cmd.Init(1, &data[0]);
1431 gl_->VertexAttrib1fv(1, &data[0]);
1432 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1435 TEST_F(GLES2ImplementationTest, VertexAttrib2f) {
1436 struct Cmds {
1437 cmds::VertexAttrib2f cmd;
1439 Cmds expected;
1440 expected.cmd.Init(1, 2, 3);
1442 gl_->VertexAttrib2f(1, 2, 3);
1443 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1446 TEST_F(GLES2ImplementationTest, VertexAttrib2fv) {
1447 GLfloat data[2] = {0};
1448 struct Cmds {
1449 cmds::VertexAttrib2fvImmediate cmd;
1450 GLfloat data[2];
1453 for (int jj = 0; jj < 2; ++jj) {
1454 data[jj] = static_cast<GLfloat>(jj);
1456 Cmds expected;
1457 expected.cmd.Init(1, &data[0]);
1458 gl_->VertexAttrib2fv(1, &data[0]);
1459 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1462 TEST_F(GLES2ImplementationTest, VertexAttrib3f) {
1463 struct Cmds {
1464 cmds::VertexAttrib3f cmd;
1466 Cmds expected;
1467 expected.cmd.Init(1, 2, 3, 4);
1469 gl_->VertexAttrib3f(1, 2, 3, 4);
1470 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1473 TEST_F(GLES2ImplementationTest, VertexAttrib3fv) {
1474 GLfloat data[3] = {0};
1475 struct Cmds {
1476 cmds::VertexAttrib3fvImmediate cmd;
1477 GLfloat data[3];
1480 for (int jj = 0; jj < 3; ++jj) {
1481 data[jj] = static_cast<GLfloat>(jj);
1483 Cmds expected;
1484 expected.cmd.Init(1, &data[0]);
1485 gl_->VertexAttrib3fv(1, &data[0]);
1486 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1489 TEST_F(GLES2ImplementationTest, VertexAttrib4f) {
1490 struct Cmds {
1491 cmds::VertexAttrib4f cmd;
1493 Cmds expected;
1494 expected.cmd.Init(1, 2, 3, 4, 5);
1496 gl_->VertexAttrib4f(1, 2, 3, 4, 5);
1497 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1500 TEST_F(GLES2ImplementationTest, VertexAttrib4fv) {
1501 GLfloat data[4] = {0};
1502 struct Cmds {
1503 cmds::VertexAttrib4fvImmediate cmd;
1504 GLfloat data[4];
1507 for (int jj = 0; jj < 4; ++jj) {
1508 data[jj] = static_cast<GLfloat>(jj);
1510 Cmds expected;
1511 expected.cmd.Init(1, &data[0]);
1512 gl_->VertexAttrib4fv(1, &data[0]);
1513 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1516 TEST_F(GLES2ImplementationTest, Viewport) {
1517 struct Cmds {
1518 cmds::Viewport cmd;
1520 Cmds expected;
1521 expected.cmd.Init(1, 2, 3, 4);
1523 gl_->Viewport(1, 2, 3, 4);
1524 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1527 TEST_F(GLES2ImplementationTest, BlitFramebufferEXT) {
1528 struct Cmds {
1529 cmds::BlitFramebufferEXT cmd;
1531 Cmds expected;
1532 expected.cmd.Init(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
1534 gl_->BlitFramebufferEXT(1, 2, 3, 4, 5, 6, 7, 8, 9, GL_NEAREST);
1535 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1538 TEST_F(GLES2ImplementationTest, RenderbufferStorageMultisampleEXT) {
1539 struct Cmds {
1540 cmds::RenderbufferStorageMultisampleEXT cmd;
1542 Cmds expected;
1543 expected.cmd.Init(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1545 gl_->RenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, GL_RGBA4, 4, 5);
1546 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1549 TEST_F(GLES2ImplementationTest, FramebufferTexture2DMultisampleEXT) {
1550 struct Cmds {
1551 cmds::FramebufferTexture2DMultisampleEXT cmd;
1553 Cmds expected;
1554 expected.cmd.Init(
1555 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0, 6);
1557 gl_->FramebufferTexture2DMultisampleEXT(
1558 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0, 6);
1559 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1562 TEST_F(GLES2ImplementationTest, TexStorage2DEXT) {
1563 struct Cmds {
1564 cmds::TexStorage2DEXT cmd;
1566 Cmds expected;
1567 expected.cmd.Init(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
1569 gl_->TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGB565, 4, 5);
1570 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1573 TEST_F(GLES2ImplementationTest, GenQueriesEXT) {
1574 GLuint ids[2] = { 0, };
1575 struct Cmds {
1576 cmds::GenQueriesEXTImmediate gen;
1577 GLuint data[2];
1579 Cmds expected;
1580 expected.gen.Init(arraysize(ids), &ids[0]);
1581 expected.data[0] = kQueriesStartId;
1582 expected.data[1] = kQueriesStartId + 1;
1583 gl_->GenQueriesEXT(arraysize(ids), &ids[0]);
1584 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1585 EXPECT_EQ(kQueriesStartId, ids[0]);
1586 EXPECT_EQ(kQueriesStartId + 1, ids[1]);
1589 TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) {
1590 GLuint ids[2] = { kQueriesStartId, kQueriesStartId + 1 };
1591 struct Cmds {
1592 cmds::DeleteQueriesEXTImmediate del;
1593 GLuint data[2];
1595 Cmds expected;
1596 expected.del.Init(arraysize(ids), &ids[0]);
1597 expected.data[0] = kQueriesStartId;
1598 expected.data[1] = kQueriesStartId + 1;
1599 gl_->DeleteQueriesEXT(arraysize(ids), &ids[0]);
1600 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1602 // TODO: Implement unit test for BeginQueryEXT
1603 // TODO: Implement unit test for InsertEventMarkerEXT
1604 // TODO: Implement unit test for PushGroupMarkerEXT
1606 TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) {
1607 struct Cmds {
1608 cmds::PopGroupMarkerEXT cmd;
1610 Cmds expected;
1611 expected.cmd.Init();
1613 gl_->PopGroupMarkerEXT();
1614 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1617 TEST_F(GLES2ImplementationTest, GenVertexArraysOES) {
1618 GLuint ids[2] = { 0, };
1619 struct Cmds {
1620 cmds::GenVertexArraysOESImmediate gen;
1621 GLuint data[2];
1623 Cmds expected;
1624 expected.gen.Init(arraysize(ids), &ids[0]);
1625 expected.data[0] = kVertexArraysStartId;
1626 expected.data[1] = kVertexArraysStartId + 1;
1627 gl_->GenVertexArraysOES(arraysize(ids), &ids[0]);
1628 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1629 EXPECT_EQ(kVertexArraysStartId, ids[0]);
1630 EXPECT_EQ(kVertexArraysStartId + 1, ids[1]);
1633 TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) {
1634 GLuint ids[2] = { kVertexArraysStartId, kVertexArraysStartId + 1 };
1635 struct Cmds {
1636 cmds::DeleteVertexArraysOESImmediate del;
1637 GLuint data[2];
1639 Cmds expected;
1640 expected.del.Init(arraysize(ids), &ids[0]);
1641 expected.data[0] = kVertexArraysStartId;
1642 expected.data[1] = kVertexArraysStartId + 1;
1643 gl_->DeleteVertexArraysOES(arraysize(ids), &ids[0]);
1644 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1647 TEST_F(GLES2ImplementationTest, IsVertexArrayOES) {
1648 struct Cmds {
1649 cmds::IsVertexArrayOES cmd;
1652 typedef cmds::IsVertexArrayOES::Result Result;
1653 Cmds expected;
1654 ExpectedMemoryInfo result1 =
1655 GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result));
1656 expected.cmd.Init(1, result1.id, result1.offset);
1658 EXPECT_CALL(*command_buffer(), OnFlush())
1659 .WillOnce(SetMemory(result1.ptr, uint32(1)))
1660 .RetiresOnSaturation();
1662 GLboolean result = gl_->IsVertexArrayOES(1);
1663 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1664 EXPECT_TRUE(result);
1666 // TODO: Implement unit test for GenSharedIdsCHROMIUM
1667 // TODO: Implement unit test for DeleteSharedIdsCHROMIUM
1668 // TODO: Implement unit test for RegisterSharedIdsCHROMIUM
1669 // TODO: Implement unit test for EnableFeatureCHROMIUM
1671 TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) {
1672 struct Cmds {
1673 cmds::ResizeCHROMIUM cmd;
1675 Cmds expected;
1676 expected.cmd.Init(1, 2, 3);
1678 gl_->ResizeCHROMIUM(1, 2, 3);
1679 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1681 // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM
1683 TEST_F(GLES2ImplementationTest, DestroyStreamTextureCHROMIUM) {
1684 struct Cmds {
1685 cmds::DestroyStreamTextureCHROMIUM cmd;
1687 Cmds expected;
1688 expected.cmd.Init(1);
1690 gl_->DestroyStreamTextureCHROMIUM(1);
1691 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1693 // TODO: Implement unit test for GetTranslatedShaderSourceANGLE
1695 TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) {
1696 struct Cmds {
1697 cmds::TexImageIOSurface2DCHROMIUM cmd;
1699 Cmds expected;
1700 expected.cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5);
1702 gl_->TexImageIOSurface2DCHROMIUM(GL_TEXTURE_2D, 2, 3, 4, 5);
1703 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1706 TEST_F(GLES2ImplementationTest, CopyTextureCHROMIUM) {
1707 struct Cmds {
1708 cmds::CopyTextureCHROMIUM cmd;
1710 Cmds expected;
1711 expected.cmd.Init(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
1713 gl_->CopyTextureCHROMIUM(1, 2, 3, 4, GL_ALPHA, GL_UNSIGNED_BYTE);
1714 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1717 TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLE) {
1718 struct Cmds {
1719 cmds::DrawArraysInstancedANGLE cmd;
1721 Cmds expected;
1722 expected.cmd.Init(GL_POINTS, 2, 3, 4);
1724 gl_->DrawArraysInstancedANGLE(GL_POINTS, 2, 3, 4);
1725 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1728 TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) {
1729 struct Cmds {
1730 cmds::VertexAttribDivisorANGLE cmd;
1732 Cmds expected;
1733 expected.cmd.Init(1, 2);
1735 gl_->VertexAttribDivisorANGLE(1, 2);
1736 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1739 TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) {
1740 GLbyte data[64] = {0};
1741 struct Cmds {
1742 cmds::ProduceTextureCHROMIUMImmediate cmd;
1743 GLbyte data[64];
1746 for (int jj = 0; jj < 64; ++jj) {
1747 data[jj] = static_cast<GLbyte>(jj);
1749 Cmds expected;
1750 expected.cmd.Init(GL_TEXTURE_2D, &data[0]);
1751 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, &data[0]);
1752 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1755 TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) {
1756 GLbyte data[64] = {0};
1757 struct Cmds {
1758 cmds::ConsumeTextureCHROMIUMImmediate cmd;
1759 GLbyte data[64];
1762 for (int jj = 0; jj < 64; ++jj) {
1763 data[jj] = static_cast<GLbyte>(jj);
1765 Cmds expected;
1766 expected.cmd.Init(GL_TEXTURE_2D, &data[0]);
1767 gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, &data[0]);
1768 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1770 // TODO: Implement unit test for BindUniformLocationCHROMIUM
1772 TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) {
1773 struct Cmds {
1774 cmds::BindTexImage2DCHROMIUM cmd;
1776 Cmds expected;
1777 expected.cmd.Init(GL_TEXTURE_2D, 2);
1779 gl_->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
1780 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1783 TEST_F(GLES2ImplementationTest, ReleaseTexImage2DCHROMIUM) {
1784 struct Cmds {
1785 cmds::ReleaseTexImage2DCHROMIUM cmd;
1787 Cmds expected;
1788 expected.cmd.Init(GL_TEXTURE_2D, 2);
1790 gl_->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, 2);
1791 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1794 TEST_F(GLES2ImplementationTest, DiscardFramebufferEXT) {
1795 GLenum data[2][1] = {{0}};
1796 struct Cmds {
1797 cmds::DiscardFramebufferEXTImmediate cmd;
1798 GLenum data[2][1];
1801 Cmds expected;
1802 for (int ii = 0; ii < 2; ++ii) {
1803 for (int jj = 0; jj < 1; ++jj) {
1804 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1807 expected.cmd.Init(1, 2, &data[0][0]);
1808 gl_->DiscardFramebufferEXT(1, 2, &data[0][0]);
1809 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1812 TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) {
1813 struct Cmds {
1814 cmds::LoseContextCHROMIUM cmd;
1816 Cmds expected;
1817 expected.cmd.Init(1, 2);
1819 gl_->LoseContextCHROMIUM(1, 2);
1820 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1822 // TODO: Implement unit test for InsertSyncPointCHROMIUM
1824 TEST_F(GLES2ImplementationTest, WaitSyncPointCHROMIUM) {
1825 struct Cmds {
1826 cmds::WaitSyncPointCHROMIUM cmd;
1828 Cmds expected;
1829 expected.cmd.Init(1);
1831 gl_->WaitSyncPointCHROMIUM(1);
1832 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1835 TEST_F(GLES2ImplementationTest, DrawBuffersEXT) {
1836 GLenum data[1][1] = {{0}};
1837 struct Cmds {
1838 cmds::DrawBuffersEXTImmediate cmd;
1839 GLenum data[1][1];
1842 Cmds expected;
1843 for (int ii = 0; ii < 1; ++ii) {
1844 for (int jj = 0; jj < 1; ++jj) {
1845 data[ii][jj] = static_cast<GLenum>(ii * 1 + jj);
1848 expected.cmd.Init(1, &data[0][0]);
1849 gl_->DrawBuffersEXT(1, &data[0][0]);
1850 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
1852 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_