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

Unified Diff: gpu/command_buffer/tests/gl_unittests.cc

Issue 138433004: Normalize _unittest.cc filename suffix for unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert ash_unittest change Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/tests/gl_unittest.cc ('k') | gpu/command_buffer/tests/gl_virtual_contexts_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_unittests.cc
diff --git a/gpu/command_buffer/tests/gl_unittests.cc b/gpu/command_buffer/tests/gl_unittests.cc
deleted file mode 100644
index b7cc7350bc45e94b2afeeafe30bc22eaea07e716..0000000000000000000000000000000000000000
--- a/gpu/command_buffer/tests/gl_unittests.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-
-#include "gpu/command_buffer/tests/gl_manager.h"
-#include "gpu/command_buffer/tests/gl_test_utils.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace gpu {
-
-class GLTest : public testing::Test {
- protected:
- virtual void SetUp() {
- gl_.Initialize(GLManager::Options());
- }
-
- virtual void TearDown() {
- gl_.Destroy();
- }
-
- GLManager gl_;
-};
-
-// Test that GL is at least minimally working.
-TEST_F(GLTest, Basic) {
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- uint8 expected[] = { 0, 255, 0, 255, };
- EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected));
- GLTestHelper::CheckGLError("no errors", __LINE__);
-}
-
-TEST_F(GLTest, BasicFBO) {
- GLuint tex = 0;
- glGenTextures(1, &tex);
- GLuint fbo = 0;
- glGenFramebuffers(1, &fbo);
- glBindTexture(GL_TEXTURE_2D, tex);
- scoped_ptr<uint8[]> pixels(new uint8 [16*16*4]);
- memset(pixels.get(), 0, 16*16*4);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels.get());
- glGenerateMipmap(GL_TEXTURE_2D);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
- tex, 0);
- EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
- glCheckFramebufferStatus(GL_FRAMEBUFFER));
- glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- uint8 expected[] = { 0, 255, 0, 255, };
- EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 16, 16, 0, expected));
- glDeleteFramebuffers(1, &fbo);
- glDeleteTextures(1, &tex);
- GLTestHelper::CheckGLError("no errors", __LINE__);
-}
-
-TEST_F(GLTest, SimpleShader) {
- static const char* v_shader_str =
- "attribute vec4 a_Position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = a_Position;\n"
- "}\n";
- static const char* f_shader_str =
- "precision mediump float;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
- "}\n";
-
- GLuint program = GLTestHelper::LoadProgram(v_shader_str, f_shader_str);
- glUseProgram(program);
- GLuint position_loc = glGetAttribLocation(program, "a_Position");
-
- GLTestHelper::SetupUnitQuad(position_loc);
-
- uint8 expected_clear[] = { 127, 0, 255, 0, };
- glClearColor(0.5f, 0.0f, 1.0f, 0.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 1, expected_clear));
- uint8 expected_draw[] = { 0, 255, 0, 255, };
- glDrawArrays(GL_TRIANGLES, 0, 6);
- EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_draw));
-}
-
-TEST_F(GLTest, GetString) {
- EXPECT_STREQ(
- "OpenGL ES 2.0 Chromium",
- reinterpret_cast<const char*>(glGetString(GL_VERSION)));
- EXPECT_STREQ(
- "OpenGL ES GLSL ES 1.0 Chromium",
- reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
- EXPECT_STREQ(
- "Chromium",
- reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
- EXPECT_STREQ(
- "Chromium",
- reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
-}
-
-} // namespace gpu
-
« no previous file with comments | « gpu/command_buffer/tests/gl_unittest.cc ('k') | gpu/command_buffer/tests/gl_virtual_contexts_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698