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

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

Issue 2602563002: Refactor DrawTextureQuad and CheckPixels in gl_tests util (Closed)
Patch Set: git cl format Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 glGenFramebuffers(1, &framebuffer); 60 glGenFramebuffers(1, &framebuffer);
61 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); 61 glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
62 glFramebufferTexture2D( 62 glFramebufferTexture2D(
63 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, source_target, source_texture, 0); 63 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, source_target, source_texture, 0);
64 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), 64 EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
65 glCheckFramebufferStatus(GL_FRAMEBUFFER)); 65 glCheckFramebufferStatus(GL_FRAMEBUFFER));
66 66
67 glClearColor(33.0 / 255.0, 44.0 / 255.0, 55.0 / 255.0, 66.0 / 255.0); 67 glClearColor(33.0 / 255.0, 44.0 / 255.0, 55.0 / 255.0, 66.0 / 255.0);
68 glClear(GL_COLOR_BUFFER_BIT); 68 glClear(GL_COLOR_BUFFER_BIT);
69 const uint8_t expected[4] = {33, 44, 55, 66}; 69 const uint8_t expected[4] = {33, 44, 55, 66};
70 EXPECT_TRUE( 70 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */, expected,
71 GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */, expected)); 71 nullptr));
72 72
73 glClearColor(14.0 / 255.0, 15.0 / 255.0, 16.0 / 255.0, 17.0 / 255.0); 73 glClearColor(14.0 / 255.0, 15.0 / 255.0, 16.0 / 255.0, 17.0 / 255.0);
74 glClear(GL_COLOR_BUFFER_BIT); 74 glClear(GL_COLOR_BUFFER_BIT);
75 const uint8_t expected2[4] = {14, 15, 16, 17}; 75 const uint8_t expected2[4] = {14, 15, 16, 17};
76 EXPECT_TRUE( 76 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */,
77 GLTestHelper::CheckPixels(0, 0, 1, 1, 1 /* tolerance */, expected2)); 77 expected2, nullptr));
78 78
79 glReleaseTexImage2DCHROMIUM(source_target, image_id); 79 glReleaseTexImage2DCHROMIUM(source_target, image_id);
80 glDestroyImageCHROMIUM(image_id); 80 glDestroyImageCHROMIUM(image_id);
81 glDeleteTextures(1, &source_texture); 81 glDeleteTextures(1, &source_texture);
82 glDeleteFramebuffers(1, &framebuffer); 82 glDeleteFramebuffers(1, &framebuffer);
83 } 83 }
84 84
85 #endif // defined(OS_MACOSX) 85 #endif // defined(OS_MACOSX)
86 86
87 } // namespace gpu 87 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698