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

Unified Diff: gpu/command_buffer/tests/occlusion_query_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/occlusion_query_unittest.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/occlusion_query_unittests.cc
diff --git a/gpu/command_buffer/tests/occlusion_query_unittests.cc b/gpu/command_buffer/tests/occlusion_query_unittests.cc
deleted file mode 100644
index 03e89163a307b3dd43376d1ec3dee48fe837d462..0000000000000000000000000000000000000000
--- a/gpu/command_buffer/tests/occlusion_query_unittests.cc
+++ /dev/null
@@ -1,151 +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 OcclusionQueryTest : public testing::Test {
- protected:
- virtual void SetUp() {
- GLManager::Options options;
- options.size = gfx::Size(512, 512);
- gl_.Initialize(options);
- }
-
- virtual void TearDown() {
- gl_.Destroy();
- }
-
- void DrawRect(float x, float z, float scale, float* color);
-
- GLManager gl_;
-
- GLint position_loc_;
- GLint matrix_loc_;
- GLint color_loc_;
-};
-
-static void SetMatrix(float x, float z, float scale, float* matrix) {
- matrix[0] = scale;
- matrix[1] = 0.0f;
- matrix[2] = 0.0f;
- matrix[3] = 0.0f;
-
- matrix[4] = 0.0f;
- matrix[5] = scale;
- matrix[6] = 0.0f;
- matrix[7] = 0.0f;
-
- matrix[8] = 0.0f;
- matrix[9] = 0.0f;
- matrix[10] = scale;
- matrix[11] = 0.0f;
-
- matrix[12] = x;
- matrix[13] = 0.0f;
- matrix[14] = z;
- matrix[15] = 1.0f;
-}
-
-void OcclusionQueryTest::DrawRect(float x, float z, float scale, float* color) {
- GLfloat matrix[16];
-
- SetMatrix(x, z, scale, matrix);
-
- // Set up the model matrix
- glUniformMatrix4fv(matrix_loc_, 1, GL_FALSE, matrix);
- glUniform4fv(color_loc_, 1, color);
-
- glDrawArrays(GL_TRIANGLES, 0, 6);
-}
-
-TEST_F(OcclusionQueryTest, Occlusion) {
-#if defined(OS_MACOSX)
- EXPECT_TRUE(GLTestHelper::HasExtension("GL_EXT_occlusion_query_boolean"))
- << "GL_EXT_occlusion_query_boolean is required on OSX";
-#endif
-
- if (!GLTestHelper::HasExtension("GL_EXT_occlusion_query_boolean")) {
- return;
- }
-
- static const char* v_shader_str =
- "uniform mat4 worldMatrix;\n"
- "attribute vec3 g_Position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = worldMatrix *\n"
- " vec4(g_Position.x, g_Position.y, g_Position.z, 1.0);\n"
- "}\n";
- static const char* f_shader_str =
- "precision mediump float;"
- "uniform vec4 color;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = color;\n"
- "}\n";
-
- GLuint program = GLTestHelper::LoadProgram(v_shader_str, f_shader_str);
-
- position_loc_ = glGetAttribLocation(program, "g_Position");
- matrix_loc_ = glGetUniformLocation(program, "worldMatrix");
- color_loc_ = glGetUniformLocation(program, "color");
-
- GLTestHelper::SetupUnitQuad(position_loc_);
-
- GLuint query = 0;
- glGenQueriesEXT(1, &query);
-
- glEnable(GL_DEPTH_TEST);
- glClearColor(0.0f, 0.1f, 0.2f, 1.0f);
-
- // Use the program object
- glUseProgram(program);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- static float red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
- DrawRect(0, 0.0f, 0.50f, red);
-
- glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, query);
- static float blue[] = { 0.0f, 0.0f, 1.0f, 1.0f };
- DrawRect(-0.125f, 0.1f, 0.25f, blue);
- glEndQueryEXT(GL_ANY_SAMPLES_PASSED_EXT);
-
- glFinish();
-
- GLuint query_status = 0;
- GLuint result = 0;
- glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result);
- EXPECT_TRUE(result);
- glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_status);
- EXPECT_FALSE(query_status);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- DrawRect(1, 0.0f, 0.50f, red);
-
- glBeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, query);
- DrawRect(-0.125f, 0.1f, 0.25f, blue);
- glEndQueryEXT(GL_ANY_SAMPLES_PASSED_EXT);
-
- glFinish();
-
- query_status = 0;
- result = 0;
- glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result);
- EXPECT_TRUE(result);
- glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_status);
- EXPECT_TRUE(query_status);
- GLTestHelper::CheckGLError("no errors", __LINE__);
-}
-
-} // namespace gpu
-
-
« no previous file with comments | « gpu/command_buffer/tests/occlusion_query_unittest.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698