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

Unified Diff: ui/gl/test/gl_test_helper.h

Issue 1354483004: Re-land: ui: Add GLImage unit test framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/test/gl_surface_test_support.cc ('k') | ui/gl/test/gl_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/test/gl_test_helper.h
diff --git a/ui/gl/test/gl_test_helper.h b/ui/gl/test/gl_test_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..f566525cb25cf6d35b9de951ac3d7185100716c5
--- /dev/null
+++ b/ui/gl/test/gl_test_helper.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GL_TEST_GL_TEST_HELPER_H_
+#define UI_GL_TEST_GL_TEST_HELPER_H_
+
+#include "base/basictypes.h"
+#include "ui/gl/gl_bindings.h"
+
+namespace gfx {
+
+class GLTestHelper {
+ public:
+ // Creates a texture object.
+ // Does not check for errors, always returns texture.
+ static GLuint CreateTexture(GLenum target);
+
+ // Compiles a shader.
+ // Does not check for errors, always returns shader.
+ static GLuint CompileShader(GLenum type, const char* src);
+
+ // Compiles a shader and checks for compilation errors.
+ // Returns shader, 0 on failure.
+ static GLuint LoadShader(GLenum type, const char* src);
+
+ // Attaches 2 shaders and links them to a program.
+ // Does not check for errors, always returns program.
+ static GLuint LinkProgram(GLuint vertex_shader, GLuint fragment_shader);
+
+ // Attaches 2 shaders, links them to a program, and checks for errors.
+ // Returns program, 0 on failure.
+ static GLuint SetupProgram(GLuint vertex_shader, GLuint fragment_shader);
+
+ // Creates a framebuffer, attaches a color buffer, and checks for errors.
+ // Returns framebuffer, 0 on failure.
+ static GLuint SetupFramebuffer(int width, int height);
+
+ // Checks an area of pixels for a color.
+ static bool CheckPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ const uint8_t expected_color[4]);
+};
+
+} // namespace gfx
+
+#endif // UI_GL_TEST_GL_TEST_HELPER_H_
« no previous file with comments | « ui/gl/test/gl_surface_test_support.cc ('k') | ui/gl/test/gl_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698