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

Side by Side Diff: ui/gl/gpu_timing_fake.cc

Issue 2747823004: Fix QueryCounter on a pending query (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/query_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/gl/gpu_timing_fake.h" 5 #include "ui/gl/gpu_timing_fake.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gl/gl_mock.h" 9 #include "ui/gl/gl_mock.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1)) 73 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1))
74 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGetIntegerv)); 74 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGetIntegerv));
75 } 75 }
76 76
77 void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) { 77 void GPUTimingFake::ExpectNoDisjointCalls(MockGLInterface& gl) {
78 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0)); 78 EXPECT_CALL(gl, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0));
79 } 79 }
80 80
81 void GPUTimingFake::ExpectGPUTimeStampQuery(MockGLInterface& gl, 81 void GPUTimingFake::ExpectGPUTimeStampQuery(MockGLInterface& gl,
82 bool elapsed_query) { 82 bool elapsed_query) {
83 EXPECT_CALL(gl, GenQueries(1, NotNull())).Times(Exactly(1)) 83 EXPECT_CALL(gl, GenQueries(1, NotNull()))
84 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries)); 84 .WillOnce(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
85 85
86 EXPECT_CALL(gl, GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, NotNull())) 86 EXPECT_CALL(gl, GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, NotNull()))
87 .WillRepeatedly(DoAll(SetArgPointee<2>(64), Return())); 87 .WillRepeatedly(DoAll(SetArgPointee<2>(64), Return()));
88 if (!elapsed_query) { 88 if (!elapsed_query) {
89 // Time Stamp based queries. 89 // Time Stamp based queries.
90 EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _)) 90 EXPECT_CALL(gl, GetInteger64v(GL_TIMESTAMP, _))
91 .WillRepeatedly( 91 .WillRepeatedly(
92 Invoke(this, &GPUTimingFake::FakeGLGetInteger64v)); 92 Invoke(this, &GPUTimingFake::FakeGLGetInteger64v));
93 93
94 EXPECT_CALL(gl, QueryCounter(_, GL_TIMESTAMP)).Times(Exactly(1)) 94 EXPECT_CALL(gl, QueryCounter(_, GL_TIMESTAMP)).Times(Exactly(1))
(...skipping 11 matching lines...) Expand all
106 106
107 EXPECT_CALL(gl, GetQueryObjectuiv(_, GL_QUERY_RESULT_AVAILABLE, 107 EXPECT_CALL(gl, GetQueryObjectuiv(_, GL_QUERY_RESULT_AVAILABLE,
108 NotNull())) 108 NotNull()))
109 .WillRepeatedly( 109 .WillRepeatedly(
110 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectuiv)); 110 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectuiv));
111 111
112 EXPECT_CALL(gl, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull())) 112 EXPECT_CALL(gl, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull()))
113 .WillRepeatedly( 113 .WillRepeatedly(
114 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectui64v)); 114 Invoke(this, &GPUTimingFake::FakeGLGetQueryObjectui64v));
115 115
116 EXPECT_CALL(gl, DeleteQueries(1, NotNull())).Times(AtLeast(1)) 116 EXPECT_CALL(gl, DeleteQueries(1, NotNull()))
117 .WillRepeatedly( 117 .WillOnce(Invoke(this, &GPUTimingFake::FakeGLDeleteQueries))
118 Invoke(this, &GPUTimingFake::FakeGLDeleteQueries)); 118 .RetiresOnSaturation();
119 } 119 }
120 120
121 void GPUTimingFake::ExpectGPUTimerQuery( 121 void GPUTimingFake::ExpectGPUTimerQuery(
122 MockGLInterface& gl, bool elapsed_query) { 122 MockGLInterface& gl, bool elapsed_query) {
123 EXPECT_CALL(gl, GenQueries(1, NotNull())) 123 EXPECT_CALL(gl, GenQueries(1, NotNull()))
124 .Times(AtLeast(elapsed_query ? 1 : 2)) 124 .Times(AtLeast(elapsed_query ? 1 : 2))
125 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries)); 125 .WillRepeatedly(Invoke(this, &GPUTimingFake::FakeGLGenQueries));
126 126
127 if (!elapsed_query) { 127 if (!elapsed_query) {
128 // Time Stamp based queries. 128 // Time Stamp based queries.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 default: 289 default:
290 FAIL() << "Invalid variable passed to GetIntegerv: " << pname; 290 FAIL() << "Invalid variable passed to GetIntegerv: " << pname;
291 } 291 }
292 } 292 }
293 293
294 GLenum GPUTimingFake::FakeGLGetError() { 294 GLenum GPUTimingFake::FakeGLGetError() {
295 return GL_NO_ERROR; 295 return GL_NO_ERROR;
296 } 296 }
297 297
298 } // namespace gl 298 } // namespace gl
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/query_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698