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

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

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
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/gles2_cmd_decoder_unittest.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 EXPECT_CALL(*gl, GetError()) 448 EXPECT_CALL(*gl, GetError())
449 .WillOnce(Return(GL_NO_ERROR)) 449 .WillOnce(Return(GL_NO_ERROR))
450 .RetiresOnSaturation(); 450 .RetiresOnSaturation();
451 } 451 }
452 GLsync kGlSync = reinterpret_cast<GLsync>(0xdeadbeef); 452 GLsync kGlSync = reinterpret_cast<GLsync>(0xdeadbeef);
453 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) { 453 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
454 EXPECT_CALL(*gl, Flush()).RetiresOnSaturation(); 454 EXPECT_CALL(*gl, Flush()).RetiresOnSaturation();
455 EXPECT_CALL(*gl, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) 455 EXPECT_CALL(*gl, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
456 .WillOnce(Return(kGlSync)) 456 .WillOnce(Return(kGlSync))
457 .RetiresOnSaturation(); 457 .RetiresOnSaturation();
458 #if DCHECK_IS_ON 458 #if DCHECK_IS_ON()
459 EXPECT_CALL(*gl, IsSync(kGlSync)) 459 EXPECT_CALL(*gl, IsSync(kGlSync))
460 .WillOnce(Return(GL_TRUE)) 460 .WillOnce(Return(GL_TRUE))
461 .RetiresOnSaturation(); 461 .RetiresOnSaturation();
462 #endif 462 #endif
463 } 463 }
464 464
465 EndQueryEXT end_cmd; 465 EndQueryEXT end_cmd;
466 end_cmd.Init(query_type.type, 1); 466 end_cmd.Init(query_type.type, 1);
467 error::Error error2 = test->ExecuteCmd(end_cmd); 467 error::Error error2 = test->ExecuteCmd(end_cmd);
468 468
469 if (query_type.is_gl) { 469 if (query_type.is_gl) {
470 EXPECT_CALL( 470 EXPECT_CALL(
471 *gl, GetQueryObjectuivARB(service_id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) 471 *gl, GetQueryObjectuivARB(service_id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
472 .WillOnce(SetArgumentPointee<2>(1)) 472 .WillOnce(SetArgumentPointee<2>(1))
473 .RetiresOnSaturation(); 473 .RetiresOnSaturation();
474 EXPECT_CALL(*gl, GetQueryObjectuivARB(service_id, GL_QUERY_RESULT_EXT, _)) 474 EXPECT_CALL(*gl, GetQueryObjectuivARB(service_id, GL_QUERY_RESULT_EXT, _))
475 .WillOnce(SetArgumentPointee<2>(1)) 475 .WillOnce(SetArgumentPointee<2>(1))
476 .RetiresOnSaturation(); 476 .RetiresOnSaturation();
477 } 477 }
478 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) { 478 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
479 #if DCHECK_IS_ON 479 #if DCHECK_IS_ON()
480 EXPECT_CALL(*gl, IsSync(kGlSync)) 480 EXPECT_CALL(*gl, IsSync(kGlSync))
481 .WillOnce(Return(GL_TRUE)) 481 .WillOnce(Return(GL_TRUE))
482 .RetiresOnSaturation(); 482 .RetiresOnSaturation();
483 #endif 483 #endif
484 EXPECT_CALL(*gl, ClientWaitSync(kGlSync, _, _)) 484 EXPECT_CALL(*gl, ClientWaitSync(kGlSync, _, _))
485 .WillOnce(Return(GL_ALREADY_SIGNALED)) 485 .WillOnce(Return(GL_ALREADY_SIGNALED))
486 .RetiresOnSaturation(); 486 .RetiresOnSaturation();
487 } 487 }
488 488
489 QueryManager* query_manager = test->GetDecoder()->GetQueryManager(); 489 QueryManager* query_manager = test->GetDecoder()->GetQueryManager();
490 ASSERT_TRUE(query_manager != NULL); 490 ASSERT_TRUE(query_manager != NULL);
491 bool process_success = query_manager->ProcessPendingQueries(false); 491 bool process_success = query_manager->ProcessPendingQueries(false);
492 492
493 EXPECT_TRUE(error1 != error::kNoError || error2 != error::kNoError || 493 EXPECT_TRUE(error1 != error::kNoError || error2 != error::kNoError ||
494 !process_success); 494 !process_success);
495 495
496 if (query_type.is_gl) { 496 if (query_type.is_gl) {
497 EXPECT_CALL(*gl, DeleteQueriesARB(1, _)).Times(1).RetiresOnSaturation(); 497 EXPECT_CALL(*gl, DeleteQueriesARB(1, _)).Times(1).RetiresOnSaturation();
498 } 498 }
499 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) { 499 if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
500 #if DCHECK_IS_ON 500 #if DCHECK_IS_ON()
501 EXPECT_CALL(*gl, IsSync(kGlSync)) 501 EXPECT_CALL(*gl, IsSync(kGlSync))
502 .WillOnce(Return(GL_TRUE)) 502 .WillOnce(Return(GL_TRUE))
503 .RetiresOnSaturation(); 503 .RetiresOnSaturation();
504 #endif 504 #endif
505 EXPECT_CALL(*gl, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation(); 505 EXPECT_CALL(*gl, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation();
506 } 506 }
507 test->ResetDecoder(); 507 test->ResetDecoder();
508 } 508 }
509 509
510 TEST_P(GLES2DecoderManualInitTest, BeginEndQueryEXTBadMemoryIdFails) { 510 TEST_P(GLES2DecoderManualInitTest, BeginEndQueryEXTBadMemoryIdFails) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 ASSERT_TRUE(query_manager != NULL); 622 ASSERT_TRUE(query_manager != NULL);
623 QueryManager::Query* query = query_manager->GetQuery(kNewClientId); 623 QueryManager::Query* query = query_manager->GetQuery(kNewClientId);
624 ASSERT_TRUE(query != NULL); 624 ASSERT_TRUE(query != NULL);
625 EXPECT_FALSE(query->pending()); 625 EXPECT_FALSE(query->pending());
626 626
627 GLsync kGlSync = reinterpret_cast<GLsync>(0xdeadbeef); 627 GLsync kGlSync = reinterpret_cast<GLsync>(0xdeadbeef);
628 EXPECT_CALL(*gl_, Flush()).RetiresOnSaturation(); 628 EXPECT_CALL(*gl_, Flush()).RetiresOnSaturation();
629 EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) 629 EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
630 .WillOnce(Return(kGlSync)) 630 .WillOnce(Return(kGlSync))
631 .RetiresOnSaturation(); 631 .RetiresOnSaturation();
632 #if DCHECK_IS_ON 632 #if DCHECK_IS_ON()
633 EXPECT_CALL(*gl_, IsSync(kGlSync)) 633 EXPECT_CALL(*gl_, IsSync(kGlSync))
634 .WillOnce(Return(GL_TRUE)) 634 .WillOnce(Return(GL_TRUE))
635 .RetiresOnSaturation(); 635 .RetiresOnSaturation();
636 #endif 636 #endif
637 637
638 EndQueryEXT end_cmd; 638 EndQueryEXT end_cmd;
639 end_cmd.Init(GL_COMMANDS_COMPLETED_CHROMIUM, 1); 639 end_cmd.Init(GL_COMMANDS_COMPLETED_CHROMIUM, 1);
640 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); 640 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
641 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 641 EXPECT_EQ(GL_NO_ERROR, GetGLError());
642 EXPECT_TRUE(query->pending()); 642 EXPECT_TRUE(query->pending());
643 643
644 #if DCHECK_IS_ON 644 #if DCHECK_IS_ON()
645 EXPECT_CALL(*gl_, IsSync(kGlSync)) 645 EXPECT_CALL(*gl_, IsSync(kGlSync))
646 .WillOnce(Return(GL_TRUE)) 646 .WillOnce(Return(GL_TRUE))
647 .RetiresOnSaturation(); 647 .RetiresOnSaturation();
648 #endif 648 #endif
649 EXPECT_CALL(*gl_, ClientWaitSync(kGlSync, _, _)) 649 EXPECT_CALL(*gl_, ClientWaitSync(kGlSync, _, _))
650 .WillOnce(Return(GL_TIMEOUT_EXPIRED)) 650 .WillOnce(Return(GL_TIMEOUT_EXPIRED))
651 .RetiresOnSaturation(); 651 .RetiresOnSaturation();
652 bool process_success = query_manager->ProcessPendingQueries(false); 652 bool process_success = query_manager->ProcessPendingQueries(false);
653 653
654 EXPECT_TRUE(process_success); 654 EXPECT_TRUE(process_success);
655 EXPECT_TRUE(query->pending()); 655 EXPECT_TRUE(query->pending());
656 656
657 #if DCHECK_IS_ON 657 #if DCHECK_IS_ON()
658 EXPECT_CALL(*gl_, IsSync(kGlSync)) 658 EXPECT_CALL(*gl_, IsSync(kGlSync))
659 .WillOnce(Return(GL_TRUE)) 659 .WillOnce(Return(GL_TRUE))
660 .RetiresOnSaturation(); 660 .RetiresOnSaturation();
661 #endif 661 #endif
662 EXPECT_CALL(*gl_, ClientWaitSync(kGlSync, _, _)) 662 EXPECT_CALL(*gl_, ClientWaitSync(kGlSync, _, _))
663 .WillOnce(Return(GL_ALREADY_SIGNALED)) 663 .WillOnce(Return(GL_ALREADY_SIGNALED))
664 .RetiresOnSaturation(); 664 .RetiresOnSaturation();
665 process_success = query_manager->ProcessPendingQueries(false); 665 process_success = query_manager->ProcessPendingQueries(false);
666 666
667 EXPECT_TRUE(process_success); 667 EXPECT_TRUE(process_success);
668 EXPECT_FALSE(query->pending()); 668 EXPECT_FALSE(query->pending());
669 669
670 #if DCHECK_IS_ON 670 #if DCHECK_IS_ON()
671 EXPECT_CALL(*gl_, IsSync(kGlSync)) 671 EXPECT_CALL(*gl_, IsSync(kGlSync))
672 .WillOnce(Return(GL_TRUE)) 672 .WillOnce(Return(GL_TRUE))
673 .RetiresOnSaturation(); 673 .RetiresOnSaturation();
674 #endif 674 #endif
675 EXPECT_CALL(*gl_, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation(); 675 EXPECT_CALL(*gl_, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation();
676 ResetDecoder(); 676 ResetDecoder();
677 } 677 }
678 678
679 TEST_P(GLES2DecoderTest, IsEnabledReturnsCachedValue) { 679 TEST_P(GLES2DecoderTest, IsEnabledReturnsCachedValue) {
680 // NOTE: There are no expectations because no GL functions should be 680 // NOTE: There are no expectations because no GL functions should be
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool()); 1158 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool());
1159 1159
1160 INSTANTIATE_TEST_CASE_P(Service, 1160 INSTANTIATE_TEST_CASE_P(Service,
1161 GLES2DecoderRGBBackbufferTest, 1161 GLES2DecoderRGBBackbufferTest,
1162 ::testing::Bool()); 1162 ::testing::Bool());
1163 1163
1164 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); 1164 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool());
1165 1165
1166 } // namespace gles2 1166 } // namespace gles2
1167 } // namespace gpu 1167 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_autogen.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698