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

Side by Side Diff: gpu/command_buffer/service/query_manager_unittest.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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.cc ('k') | gpu/config/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/query_manager.h" 5 #include "gpu/command_buffer/service/query_manager.h"
6 #include "gpu/command_buffer/common/gles2_cmd_format.h" 6 #include "gpu/command_buffer/common/gles2_cmd_format.h"
7 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 7 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
8 #include "gpu/command_buffer/service/error_state_mock.h" 8 #include "gpu/command_buffer/service/error_state_mock.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 decoder_.reset(); 54 decoder_.reset();
55 manager_->Destroy(false); 55 manager_->Destroy(false);
56 manager_.reset(); 56 manager_.reset();
57 engine_.reset(); 57 engine_.reset();
58 GpuServiceTest::TearDown(); 58 GpuServiceTest::TearDown();
59 } 59 }
60 60
61 QueryManager::Query* CreateQuery( 61 QueryManager::Query* CreateQuery(
62 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset, 62 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset,
63 GLuint service_id) { 63 GLuint service_id) {
64 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) 64 EXPECT_CALL(*gl_, GenQueries(1, _))
65 .WillOnce(SetArgumentPointee<1>(service_id)) 65 .WillOnce(SetArgumentPointee<1>(service_id))
66 .RetiresOnSaturation(); 66 .RetiresOnSaturation();
67 return manager_->CreateQuery(target, client_id, shm_id, shm_offset); 67 return manager_->CreateQuery(target, client_id, shm_id, shm_offset);
68 } 68 }
69 69
70 void QueueQuery(QueryManager::Query* query, 70 void QueueQuery(QueryManager::Query* query,
71 GLuint service_id, 71 GLuint service_id,
72 base::subtle::Atomic32 submit_count) { 72 base::subtle::Atomic32 submit_count) {
73 EXPECT_CALL(*gl_, BeginQueryARB(query->target(), service_id)) 73 EXPECT_CALL(*gl_, BeginQuery(query->target(), service_id))
74 .Times(1) 74 .Times(1)
75 .RetiresOnSaturation(); 75 .RetiresOnSaturation();
76 EXPECT_CALL(*gl_, EndQueryARB(query->target())) 76 EXPECT_CALL(*gl_, EndQuery(query->target()))
77 .Times(1) 77 .Times(1)
78 .RetiresOnSaturation(); 78 .RetiresOnSaturation();
79 EXPECT_TRUE(manager_->BeginQuery(query)); 79 EXPECT_TRUE(manager_->BeginQuery(query));
80 EXPECT_TRUE(manager_->EndQuery(query, submit_count)); 80 EXPECT_TRUE(manager_->EndQuery(query, submit_count));
81 } 81 }
82 82
83 scoped_ptr<MockGLES2Decoder> decoder_; 83 scoped_ptr<MockGLES2Decoder> decoder_;
84 scoped_ptr<QueryManager> manager_; 84 scoped_ptr<QueryManager> manager_;
85 85
86 private: 86 private:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 TEST_F(QueryManagerTest, Destroy) { 171 TEST_F(QueryManagerTest, Destroy) {
172 const GLuint kClient1Id = 1; 172 const GLuint kClient1Id = 1;
173 const GLuint kService1Id = 11; 173 const GLuint kService1Id = 11;
174 174
175 // Create Query. 175 // Create Query.
176 scoped_refptr<QueryManager::Query> query( 176 scoped_refptr<QueryManager::Query> query(
177 CreateQuery(GL_ANY_SAMPLES_PASSED_EXT, kClient1Id, 177 CreateQuery(GL_ANY_SAMPLES_PASSED_EXT, kClient1Id,
178 kSharedMemoryId, kSharedMemoryOffset, kService1Id)); 178 kSharedMemoryId, kSharedMemoryOffset, kService1Id));
179 ASSERT_TRUE(query.get() != NULL); 179 ASSERT_TRUE(query.get() != NULL);
180 EXPECT_CALL(*gl_, DeleteQueriesARB(1, ::testing::Pointee(kService1Id))) 180 EXPECT_CALL(*gl_, DeleteQueries(1, ::testing::Pointee(kService1Id)))
181 .Times(1) 181 .Times(1)
182 .RetiresOnSaturation(); 182 .RetiresOnSaturation();
183 manager_->Destroy(true); 183 manager_->Destroy(true);
184 // Check we get nothing for a non-existent query. 184 // Check we get nothing for a non-existent query.
185 EXPECT_TRUE(manager_->GetQuery(kClient1Id) == NULL); 185 EXPECT_TRUE(manager_->GetQuery(kClient1Id) == NULL);
186 // Check query is deleted 186 // Check query is deleted
187 EXPECT_TRUE(query->IsDeleted()); 187 EXPECT_TRUE(query->IsDeleted());
188 } 188 }
189 189
190 TEST_F(QueryManagerTest, QueryBasic) { 190 TEST_F(QueryManagerTest, QueryBasic) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 sync->Reset(); 229 sync->Reset();
230 230
231 // Queue it 231 // Queue it
232 QueueQuery(query.get(), kService1Id, kSubmitCount); 232 QueueQuery(query.get(), kService1Id, kSubmitCount);
233 EXPECT_TRUE(query->pending()); 233 EXPECT_TRUE(query->pending());
234 EXPECT_TRUE(manager_->HavePendingQueries()); 234 EXPECT_TRUE(manager_->HavePendingQueries());
235 235
236 // Process with return not available. 236 // Process with return not available.
237 // Expect 1 GL command. 237 // Expect 1 GL command.
238 EXPECT_CALL(*gl_, 238 EXPECT_CALL(*gl_,
239 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 239 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
240 .WillOnce(SetArgumentPointee<2>(0)) 240 .WillOnce(SetArgumentPointee<2>(0))
241 .RetiresOnSaturation(); 241 .RetiresOnSaturation();
242 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); 242 EXPECT_TRUE(manager_->ProcessPendingQueries(false));
243 EXPECT_TRUE(query->pending()); 243 EXPECT_TRUE(query->pending());
244 EXPECT_EQ(0, sync->process_count); 244 EXPECT_EQ(0, sync->process_count);
245 EXPECT_EQ(0u, sync->result); 245 EXPECT_EQ(0u, sync->result);
246 246
247 // Process with return available. 247 // Process with return available.
248 // Expect 2 GL commands. 248 // Expect 2 GL commands.
249 EXPECT_CALL(*gl_, 249 EXPECT_CALL(*gl_,
250 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 250 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
251 .WillOnce(SetArgumentPointee<2>(1)) 251 .WillOnce(SetArgumentPointee<2>(1))
252 .RetiresOnSaturation(); 252 .RetiresOnSaturation();
253 EXPECT_CALL(*gl_, 253 EXPECT_CALL(*gl_,
254 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) 254 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_EXT, _))
255 .WillOnce(SetArgumentPointee<2>(kResult)) 255 .WillOnce(SetArgumentPointee<2>(kResult))
256 .RetiresOnSaturation(); 256 .RetiresOnSaturation();
257 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); 257 EXPECT_TRUE(manager_->ProcessPendingQueries(false));
258 EXPECT_FALSE(query->pending()); 258 EXPECT_FALSE(query->pending());
259 EXPECT_EQ(kSubmitCount, sync->process_count); 259 EXPECT_EQ(kSubmitCount, sync->process_count);
260 EXPECT_EQ(kResult, sync->result); 260 EXPECT_EQ(kResult, sync->result);
261 EXPECT_FALSE(manager_->HavePendingQueries()); 261 EXPECT_FALSE(manager_->HavePendingQueries());
262 262
263 // Process with no queries. 263 // Process with no queries.
264 // Expect no GL commands/ 264 // Expect no GL commands/
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 EXPECT_TRUE(query1->pending()); 316 EXPECT_TRUE(query1->pending());
317 EXPECT_TRUE(query2->pending()); 317 EXPECT_TRUE(query2->pending());
318 EXPECT_TRUE(query3->pending()); 318 EXPECT_TRUE(query3->pending());
319 EXPECT_TRUE(manager_->HavePendingQueries()); 319 EXPECT_TRUE(manager_->HavePendingQueries());
320 320
321 // Process with return available for first 2 queries. 321 // Process with return available for first 2 queries.
322 // Expect 4 GL commands. 322 // Expect 4 GL commands.
323 { 323 {
324 InSequence s; 324 InSequence s;
325 EXPECT_CALL(*gl_, 325 EXPECT_CALL(*gl_,
326 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 326 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
327 .WillOnce(SetArgumentPointee<2>(1)) 327 .WillOnce(SetArgumentPointee<2>(1))
328 .RetiresOnSaturation(); 328 .RetiresOnSaturation();
329 EXPECT_CALL(*gl_, 329 EXPECT_CALL(*gl_,
330 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) 330 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_EXT, _))
331 .WillOnce(SetArgumentPointee<2>(kResult1)) 331 .WillOnce(SetArgumentPointee<2>(kResult1))
332 .RetiresOnSaturation(); 332 .RetiresOnSaturation();
333 EXPECT_CALL(*gl_, 333 EXPECT_CALL(*gl_,
334 GetQueryObjectuivARB(kService2Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 334 GetQueryObjectuiv(kService2Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
335 .WillOnce(SetArgumentPointee<2>(1)) 335 .WillOnce(SetArgumentPointee<2>(1))
336 .RetiresOnSaturation(); 336 .RetiresOnSaturation();
337 EXPECT_CALL(*gl_, 337 EXPECT_CALL(*gl_,
338 GetQueryObjectuivARB(kService2Id, GL_QUERY_RESULT_EXT, _)) 338 GetQueryObjectuiv(kService2Id, GL_QUERY_RESULT_EXT, _))
339 .WillOnce(SetArgumentPointee<2>(kResult2)) 339 .WillOnce(SetArgumentPointee<2>(kResult2))
340 .RetiresOnSaturation(); 340 .RetiresOnSaturation();
341 EXPECT_CALL(*gl_, 341 EXPECT_CALL(*gl_,
342 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 342 GetQueryObjectuiv(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
343 .WillOnce(SetArgumentPointee<2>(0)) 343 .WillOnce(SetArgumentPointee<2>(0))
344 .RetiresOnSaturation(); 344 .RetiresOnSaturation();
345 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); 345 EXPECT_TRUE(manager_->ProcessPendingQueries(false));
346 } 346 }
347 EXPECT_FALSE(query1->pending()); 347 EXPECT_FALSE(query1->pending());
348 EXPECT_FALSE(query2->pending()); 348 EXPECT_FALSE(query2->pending());
349 EXPECT_TRUE(query3->pending()); 349 EXPECT_TRUE(query3->pending());
350 EXPECT_EQ(kSubmitCount1, sync1->process_count); 350 EXPECT_EQ(kSubmitCount1, sync1->process_count);
351 EXPECT_EQ(kSubmitCount2, sync2->process_count); 351 EXPECT_EQ(kSubmitCount2, sync2->process_count);
352 EXPECT_EQ(kResult1, sync1->result); 352 EXPECT_EQ(kResult1, sync1->result);
353 EXPECT_EQ(kResult2, sync2->result); 353 EXPECT_EQ(kResult2, sync2->result);
354 EXPECT_EQ(0, sync3->process_count); 354 EXPECT_EQ(0, sync3->process_count);
355 EXPECT_EQ(0u, sync3->result); 355 EXPECT_EQ(0u, sync3->result);
356 EXPECT_TRUE(manager_->HavePendingQueries()); 356 EXPECT_TRUE(manager_->HavePendingQueries());
357 357
358 // Process with renaming query. No result. 358 // Process with renaming query. No result.
359 // Expect 1 GL commands. 359 // Expect 1 GL commands.
360 EXPECT_CALL(*gl_, 360 EXPECT_CALL(*gl_,
361 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 361 GetQueryObjectuiv(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
362 .WillOnce(SetArgumentPointee<2>(0)) 362 .WillOnce(SetArgumentPointee<2>(0))
363 .RetiresOnSaturation(); 363 .RetiresOnSaturation();
364 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); 364 EXPECT_TRUE(manager_->ProcessPendingQueries(false));
365 EXPECT_TRUE(query3->pending()); 365 EXPECT_TRUE(query3->pending());
366 EXPECT_EQ(0, sync3->process_count); 366 EXPECT_EQ(0, sync3->process_count);
367 EXPECT_EQ(0u, sync3->result); 367 EXPECT_EQ(0u, sync3->result);
368 EXPECT_TRUE(manager_->HavePendingQueries()); 368 EXPECT_TRUE(manager_->HavePendingQueries());
369 369
370 // Process with renaming query. With result. 370 // Process with renaming query. With result.
371 // Expect 2 GL commands. 371 // Expect 2 GL commands.
372 EXPECT_CALL(*gl_, 372 EXPECT_CALL(*gl_,
373 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 373 GetQueryObjectuiv(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
374 .WillOnce(SetArgumentPointee<2>(1)) 374 .WillOnce(SetArgumentPointee<2>(1))
375 .RetiresOnSaturation(); 375 .RetiresOnSaturation();
376 EXPECT_CALL(*gl_, 376 EXPECT_CALL(*gl_,
377 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_EXT, _)) 377 GetQueryObjectuiv(kService3Id, GL_QUERY_RESULT_EXT, _))
378 .WillOnce(SetArgumentPointee<2>(kResult3)) 378 .WillOnce(SetArgumentPointee<2>(kResult3))
379 .RetiresOnSaturation(); 379 .RetiresOnSaturation();
380 EXPECT_TRUE(manager_->ProcessPendingQueries(false)); 380 EXPECT_TRUE(manager_->ProcessPendingQueries(false));
381 EXPECT_FALSE(query3->pending()); 381 EXPECT_FALSE(query3->pending());
382 EXPECT_EQ(kSubmitCount3, sync3->process_count); 382 EXPECT_EQ(kSubmitCount3, sync3->process_count);
383 EXPECT_EQ(kResult3, sync3->result); 383 EXPECT_EQ(kResult3, sync3->result);
384 EXPECT_FALSE(manager_->HavePendingQueries()); 384 EXPECT_FALSE(manager_->HavePendingQueries());
385 } 385 }
386 386
387 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryId) { 387 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryId) {
388 const GLuint kClient1Id = 1; 388 const GLuint kClient1Id = 1;
389 const GLuint kService1Id = 11; 389 const GLuint kService1Id = 11;
390 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; 390 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT;
391 const base::subtle::Atomic32 kSubmitCount = 123; 391 const base::subtle::Atomic32 kSubmitCount = 123;
392 const GLuint kResult = 1; 392 const GLuint kResult = 1;
393 393
394 // Create Query. 394 // Create Query.
395 scoped_refptr<QueryManager::Query> query( 395 scoped_refptr<QueryManager::Query> query(
396 CreateQuery(kTarget, kClient1Id, 396 CreateQuery(kTarget, kClient1Id,
397 kInvalidSharedMemoryId, kSharedMemoryOffset, kService1Id)); 397 kInvalidSharedMemoryId, kSharedMemoryOffset, kService1Id));
398 ASSERT_TRUE(query.get() != NULL); 398 ASSERT_TRUE(query.get() != NULL);
399 399
400 // Queue it 400 // Queue it
401 QueueQuery(query.get(), kService1Id, kSubmitCount); 401 QueueQuery(query.get(), kService1Id, kSubmitCount);
402 402
403 // Process with return available. 403 // Process with return available.
404 // Expect 2 GL commands. 404 // Expect 2 GL commands.
405 EXPECT_CALL(*gl_, 405 EXPECT_CALL(*gl_,
406 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 406 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
407 .WillOnce(SetArgumentPointee<2>(1)) 407 .WillOnce(SetArgumentPointee<2>(1))
408 .RetiresOnSaturation(); 408 .RetiresOnSaturation();
409 EXPECT_CALL(*gl_, 409 EXPECT_CALL(*gl_,
410 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) 410 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_EXT, _))
411 .WillOnce(SetArgumentPointee<2>(kResult)) 411 .WillOnce(SetArgumentPointee<2>(kResult))
412 .RetiresOnSaturation(); 412 .RetiresOnSaturation();
413 EXPECT_FALSE(manager_->ProcessPendingQueries(false)); 413 EXPECT_FALSE(manager_->ProcessPendingQueries(false));
414 } 414 }
415 415
416 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryOffset) { 416 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryOffset) {
417 const GLuint kClient1Id = 1; 417 const GLuint kClient1Id = 1;
418 const GLuint kService1Id = 11; 418 const GLuint kService1Id = 11;
419 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; 419 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT;
420 const base::subtle::Atomic32 kSubmitCount = 123; 420 const base::subtle::Atomic32 kSubmitCount = 123;
421 const GLuint kResult = 1; 421 const GLuint kResult = 1;
422 422
423 // Create Query. 423 // Create Query.
424 scoped_refptr<QueryManager::Query> query( 424 scoped_refptr<QueryManager::Query> query(
425 CreateQuery(kTarget, kClient1Id, 425 CreateQuery(kTarget, kClient1Id,
426 kSharedMemoryId, kInvalidSharedMemoryOffset, kService1Id)); 426 kSharedMemoryId, kInvalidSharedMemoryOffset, kService1Id));
427 ASSERT_TRUE(query.get() != NULL); 427 ASSERT_TRUE(query.get() != NULL);
428 428
429 // Queue it 429 // Queue it
430 QueueQuery(query.get(), kService1Id, kSubmitCount); 430 QueueQuery(query.get(), kService1Id, kSubmitCount);
431 431
432 // Process with return available. 432 // Process with return available.
433 // Expect 2 GL commands. 433 // Expect 2 GL commands.
434 EXPECT_CALL(*gl_, 434 EXPECT_CALL(*gl_,
435 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 435 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
436 .WillOnce(SetArgumentPointee<2>(1)) 436 .WillOnce(SetArgumentPointee<2>(1))
437 .RetiresOnSaturation(); 437 .RetiresOnSaturation();
438 EXPECT_CALL(*gl_, 438 EXPECT_CALL(*gl_,
439 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) 439 GetQueryObjectuiv(kService1Id, GL_QUERY_RESULT_EXT, _))
440 .WillOnce(SetArgumentPointee<2>(kResult)) 440 .WillOnce(SetArgumentPointee<2>(kResult))
441 .RetiresOnSaturation(); 441 .RetiresOnSaturation();
442 EXPECT_FALSE(manager_->ProcessPendingQueries(false)); 442 EXPECT_FALSE(manager_->ProcessPendingQueries(false));
443 } 443 }
444 444
445 TEST_F(QueryManagerTest, ExitWithPendingQuery) { 445 TEST_F(QueryManagerTest, ExitWithPendingQuery) {
446 const GLuint kClient1Id = 1; 446 const GLuint kClient1Id = 1;
447 const GLuint kService1Id = 11; 447 const GLuint kService1Id = 11;
448 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; 448 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT;
449 const base::subtle::Atomic32 kSubmitCount = 123; 449 const base::subtle::Atomic32 kSubmitCount = 123;
(...skipping 17 matching lines...) Expand all
467 const base::subtle::Atomic32 kSubmitCount = 123; 467 const base::subtle::Atomic32 kSubmitCount = 123;
468 468
469 TestHelper::SetupFeatureInfoInitExpectations( 469 TestHelper::SetupFeatureInfoInitExpectations(
470 gl_.get(), 470 gl_.get(),
471 "GL_ARB_occlusion_query2"); 471 "GL_ARB_occlusion_query2");
472 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); 472 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo());
473 feature_info->Initialize(); 473 feature_info->Initialize();
474 scoped_ptr<QueryManager> manager( 474 scoped_ptr<QueryManager> manager(
475 new QueryManager(decoder_.get(), feature_info.get())); 475 new QueryManager(decoder_.get(), feature_info.get()));
476 476
477 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) 477 EXPECT_CALL(*gl_, GenQueries(1, _))
478 .WillOnce(SetArgumentPointee<1>(kService1Id)) 478 .WillOnce(SetArgumentPointee<1>(kService1Id))
479 .RetiresOnSaturation(); 479 .RetiresOnSaturation();
480 QueryManager::Query* query = manager->CreateQuery( 480 QueryManager::Query* query = manager->CreateQuery(
481 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); 481 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset);
482 ASSERT_TRUE(query != NULL); 482 ASSERT_TRUE(query != NULL);
483 483
484 EXPECT_CALL(*gl_, BeginQueryARB(GL_ANY_SAMPLES_PASSED_EXT, kService1Id)) 484 EXPECT_CALL(*gl_, BeginQuery(GL_ANY_SAMPLES_PASSED_EXT, kService1Id))
485 .Times(1) 485 .Times(1)
486 .RetiresOnSaturation(); 486 .RetiresOnSaturation();
487 EXPECT_CALL(*gl_, EndQueryARB(GL_ANY_SAMPLES_PASSED_EXT)) 487 EXPECT_CALL(*gl_, EndQuery(GL_ANY_SAMPLES_PASSED_EXT))
488 .Times(1) 488 .Times(1)
489 .RetiresOnSaturation(); 489 .RetiresOnSaturation();
490 EXPECT_TRUE(manager->BeginQuery(query)); 490 EXPECT_TRUE(manager->BeginQuery(query));
491 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); 491 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount));
492 manager->Destroy(false); 492 manager->Destroy(false);
493 } 493 }
494 494
495 // Test that when based on ARB_occlusion_query we use GL_SAMPLES_PASSED_ARB 495 // Test that when based on ARB_occlusion_query we use GL_SAMPLES_PASSED_ARB
496 // for GL_ANY_SAMPLES_PASSED_EXT 496 // for GL_ANY_SAMPLES_PASSED_EXT
497 TEST_F(QueryManagerTest, ARBOcclusionQuery) { 497 TEST_F(QueryManagerTest, ARBOcclusionQuery) {
498 const GLuint kClient1Id = 1; 498 const GLuint kClient1Id = 1;
499 const GLuint kService1Id = 11; 499 const GLuint kService1Id = 11;
500 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; 500 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT;
501 const base::subtle::Atomic32 kSubmitCount = 123; 501 const base::subtle::Atomic32 kSubmitCount = 123;
502 502
503 TestHelper::SetupFeatureInfoInitExpectations( 503 TestHelper::SetupFeatureInfoInitExpectations(
504 gl_.get(), 504 gl_.get(),
505 "GL_ARB_occlusion_query"); 505 "GL_ARB_occlusion_query");
506 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); 506 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo());
507 feature_info->Initialize(); 507 feature_info->Initialize();
508 scoped_ptr<QueryManager> manager( 508 scoped_ptr<QueryManager> manager(
509 new QueryManager(decoder_.get(), feature_info.get())); 509 new QueryManager(decoder_.get(), feature_info.get()));
510 510
511 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) 511 EXPECT_CALL(*gl_, GenQueries(1, _))
512 .WillOnce(SetArgumentPointee<1>(kService1Id)) 512 .WillOnce(SetArgumentPointee<1>(kService1Id))
513 .RetiresOnSaturation(); 513 .RetiresOnSaturation();
514 QueryManager::Query* query = manager->CreateQuery( 514 QueryManager::Query* query = manager->CreateQuery(
515 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); 515 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset);
516 ASSERT_TRUE(query != NULL); 516 ASSERT_TRUE(query != NULL);
517 517
518 EXPECT_CALL(*gl_, BeginQueryARB(GL_SAMPLES_PASSED_ARB, kService1Id)) 518 EXPECT_CALL(*gl_, BeginQuery(GL_SAMPLES_PASSED_ARB, kService1Id))
519 .Times(1) 519 .Times(1)
520 .RetiresOnSaturation(); 520 .RetiresOnSaturation();
521 EXPECT_CALL(*gl_, EndQueryARB(GL_SAMPLES_PASSED_ARB)) 521 EXPECT_CALL(*gl_, EndQuery(GL_SAMPLES_PASSED_ARB))
522 .Times(1) 522 .Times(1)
523 .RetiresOnSaturation(); 523 .RetiresOnSaturation();
524 EXPECT_TRUE(manager->BeginQuery(query)); 524 EXPECT_TRUE(manager->BeginQuery(query));
525 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); 525 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount));
526 manager->Destroy(false); 526 manager->Destroy(false);
527 } 527 }
528 528
529 TEST_F(QueryManagerTest, GetErrorQuery) { 529 TEST_F(QueryManagerTest, GetErrorQuery) {
530 const GLuint kClient1Id = 1; 530 const GLuint kClient1Id = 1;
531 const GLenum kTarget = GL_GET_ERROR_QUERY_CHROMIUM; 531 const GLenum kTarget = GL_GET_ERROR_QUERY_CHROMIUM;
(...skipping 29 matching lines...) Expand all
561 561
562 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); 562 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result);
563 563
564 manager->Destroy(false); 564 manager->Destroy(false);
565 } 565 }
566 566
567 } // namespace gles2 567 } // namespace gles2
568 } // namespace gpu 568 } // namespace gpu
569 569
570 570
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/query_manager.cc ('k') | gpu/config/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698