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

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: Add clean up code Created 5 years, 3 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
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..d7b8c01839662660b8410d949ae3e84a462ac309
--- /dev/null
+++ b/ui/gl/test/gl_test_helper.h
@@ -0,0 +1,54 @@
+// 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.
Daniele Castagna 2015/09/30 19:17:36 You might want to specify it binds it too.
reveman 2015/10/01 04:01:37 I made sure that no code relies on that instead.
+ // 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);
Daniele Castagna 2015/09/30 19:17:36 Can this be private?
reveman 2015/10/01 04:01:37 I'm keeping it like this so it's the same as gpu/c
+
+ // 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);
Daniele Castagna 2015/09/30 19:17:36 Same here, can this be private?
reveman 2015/10/01 04:01:37 Keeping it for the same reason.
+
+ // 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);
+
+ // Compiles 2 shaders, attaches and links them to a program
+ // Returns program, 0 on failure.
+ static GLuint LoadProgram(const char* vertex_shader_src,
Daniele Castagna 2015/09/30 19:17:36 Is this used anywhere?
reveman 2015/10/01 04:01:37 No, forgot to remove it from the header.
+ const char* fragment_shader_src);
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698