OLD | NEW |
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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 scoped_ptr<MockClientGpuControl> gpu_control_; | 497 scoped_ptr<MockClientGpuControl> gpu_control_; |
498 scoped_ptr<GLES2CmdHelper> helper_; | 498 scoped_ptr<GLES2CmdHelper> helper_; |
499 scoped_ptr<MockTransferBuffer> transfer_buffer_; | 499 scoped_ptr<MockTransferBuffer> transfer_buffer_; |
500 scoped_ptr<GLES2Implementation> gl_; | 500 scoped_ptr<GLES2Implementation> gl_; |
501 CommandBufferEntry* commands_; | 501 CommandBufferEntry* commands_; |
502 int token_; | 502 int token_; |
503 }; | 503 }; |
504 | 504 |
505 GLES2ImplementationTest() : commands_(NULL) {} | 505 GLES2ImplementationTest() : commands_(NULL) {} |
506 | 506 |
507 virtual void SetUp() override; | 507 void SetUp() override; |
508 virtual void TearDown() override; | 508 void TearDown() override; |
509 | 509 |
510 bool NoCommandsWritten() { | 510 bool NoCommandsWritten() { |
511 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); | 511 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); |
512 const uint8* cmds = reinterpret_cast<const uint8*>(ring_buffer->memory()); | 512 const uint8* cmds = reinterpret_cast<const uint8*>(ring_buffer->memory()); |
513 const uint8* end = cmds + ring_buffer->size(); | 513 const uint8* end = cmds + ring_buffer->size(); |
514 for (; cmds < end; ++cmds) { | 514 for (; cmds < end; ++cmds) { |
515 if (*cmds != kInitialValue) { | 515 if (*cmds != kInitialValue) { |
516 return false; | 516 return false; |
517 } | 517 } |
518 } | 518 } |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 ASSERT_TRUE(Initialize(init_options)); | 621 ASSERT_TRUE(Initialize(init_options)); |
622 } | 622 } |
623 | 623 |
624 void GLES2ImplementationTest::TearDown() { | 624 void GLES2ImplementationTest::TearDown() { |
625 for (int i = 0; i < kNumTestContexts; i++) | 625 for (int i = 0; i < kNumTestContexts; i++) |
626 test_contexts_[i].TearDown(); | 626 test_contexts_[i].TearDown(); |
627 } | 627 } |
628 | 628 |
629 class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { | 629 class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { |
630 protected: | 630 protected: |
631 virtual void SetUp() override {} | 631 void SetUp() override {} |
632 }; | 632 }; |
633 | 633 |
634 class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest { | 634 class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest { |
635 protected: | 635 protected: |
636 virtual void SetUp() override; | 636 void SetUp() override; |
637 | 637 |
638 template <class ResApi> | 638 template <class ResApi> |
639 void FlushGenerationTest() { | 639 void FlushGenerationTest() { |
640 GLuint id1, id2, id3; | 640 GLuint id1, id2, id3; |
641 | 641 |
642 // Generate valid id. | 642 // Generate valid id. |
643 ResApi::Gen(gl_, 1, &id1); | 643 ResApi::Gen(gl_, 1, &id1); |
644 EXPECT_NE(id1, 0u); | 644 EXPECT_NE(id1, 0u); |
645 | 645 |
646 // Delete id1 and generate id2. id1 should not be reused. | 646 // Delete id1 and generate id2. id1 should not be reused. |
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 ContextInitOptions init_options; | 3403 ContextInitOptions init_options; |
3404 init_options.bind_generates_resource_client = true; | 3404 init_options.bind_generates_resource_client = true; |
3405 init_options.bind_generates_resource_service = false; | 3405 init_options.bind_generates_resource_service = false; |
3406 EXPECT_FALSE(Initialize(init_options)); | 3406 EXPECT_FALSE(Initialize(init_options)); |
3407 } | 3407 } |
3408 | 3408 |
3409 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3409 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3410 | 3410 |
3411 } // namespace gles2 | 3411 } // namespace gles2 |
3412 } // namespace gpu | 3412 } // namespace gpu |
OLD | NEW |