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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h> 7 #include <GLES2/gl2extchromium.h>
8 #include <stdint.h>
8 9
9 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
10 #include "gpu/command_buffer/tests/gl_manager.h" 11 #include "gpu/command_buffer/tests/gl_manager.h"
11 #include "gpu/command_buffer/tests/gl_test_utils.h" 12 #include "gpu/command_buffer/tests/gl_test_utils.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace gpu { 16 namespace gpu {
16 17
17 class QueryTest : public testing::Test { 18 class QueryTest : public testing::Test {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // run this test. 66 // run this test.
66 EXPECT_LE(result, base::TimeDelta(after - before).InMicroseconds()); 67 EXPECT_LE(result, base::TimeDelta(after - before).InMicroseconds());
67 68
68 result = 0; 69 result = 0;
69 available = 0; 70 available = 0;
70 glGetQueryObjectuivEXT(error_query, 71 glGetQueryObjectuivEXT(error_query,
71 GL_QUERY_RESULT_AVAILABLE_EXT, 72 GL_QUERY_RESULT_AVAILABLE_EXT,
72 &available); 73 &available);
73 EXPECT_TRUE(available); 74 EXPECT_TRUE(available);
74 glGetQueryObjectuivEXT(error_query, GL_QUERY_RESULT_EXT, &result); 75 glGetQueryObjectuivEXT(error_query, GL_QUERY_RESULT_EXT, &result);
75 EXPECT_EQ(static_cast<uint32>(GL_INVALID_ENUM), result); 76 EXPECT_EQ(static_cast<uint32_t>(GL_INVALID_ENUM), result);
76 } 77 }
77 78
78 TEST_F(QueryTest, GetErrorBasic) { 79 TEST_F(QueryTest, GetErrorBasic) {
79 EXPECT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_get_error_query")); 80 EXPECT_TRUE(GLTestHelper::HasExtension("GL_CHROMIUM_get_error_query"));
80 81
81 GLuint query = 0; 82 GLuint query = 0;
82 glGenQueriesEXT(1, &query); 83 glGenQueriesEXT(1, &query);
83 84
84 GLuint query_status = 0; 85 GLuint query_status = 0;
85 GLuint result = 0; 86 GLuint result = 0;
86 87
87 glBeginQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM, query); 88 glBeginQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM, query);
88 glEnable(GL_TEXTURE_2D); // Generates an INVALID_ENUM error 89 glEnable(GL_TEXTURE_2D); // Generates an INVALID_ENUM error
89 glEndQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM); 90 glEndQueryEXT(GL_GET_ERROR_QUERY_CHROMIUM);
90 91
91 glFinish(); 92 glFinish();
92 93
93 query_status = 0; 94 query_status = 0;
94 result = 0; 95 result = 0;
95 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result); 96 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result);
96 EXPECT_TRUE(result); 97 EXPECT_TRUE(result);
97 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_status); 98 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_EXT, &query_status);
98 EXPECT_EQ(static_cast<uint32>(GL_INVALID_ENUM), query_status); 99 EXPECT_EQ(static_cast<uint32_t>(GL_INVALID_ENUM), query_status);
99 } 100 }
100 101
101 TEST_F(QueryTest, DISABLED_LatencyQueryBasic) { 102 TEST_F(QueryTest, DISABLED_LatencyQueryBasic) {
102 EXPECT_TRUE(GLTestHelper::HasExtension( 103 EXPECT_TRUE(GLTestHelper::HasExtension(
103 "GL_CHROMIUM_command_buffer_latency_query")); 104 "GL_CHROMIUM_command_buffer_latency_query"));
104 105
105 GLuint query = 0; 106 GLuint query = 0;
106 glGenQueriesEXT(1, &query); 107 glGenQueriesEXT(1, &query);
107 108
108 GLuint query_result = 0; 109 GLuint query_result = 0;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 glEndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); 188 glEndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM);
188 glFinish(); 189 glFinish();
189 GLuint result = 0; 190 GLuint result = 0;
190 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result); 191 glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE_EXT, &result);
191 EXPECT_EQ(1u, result); 192 EXPECT_EQ(1u, result);
192 glDeleteQueriesEXT(1, &query); 193 glDeleteQueriesEXT(1, &query);
193 GLTestHelper::CheckGLError("no errors", __LINE__); 194 GLTestHelper::CheckGLError("no errors", __LINE__);
194 } 195 }
195 196
196 } // namespace gpu 197 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_program_unittest.cc ('k') | gpu/command_buffer/tests/gl_readback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698