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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
7 | 7 |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/service/buffer_manager.h" | 10 #include "gpu/command_buffer/service/buffer_manager.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 template <typename T, typename Command> | 63 template <typename T, typename Command> |
64 T GetImmediateDataAs(Command* cmd) { | 64 T GetImmediateDataAs(Command* cmd) { |
65 return reinterpret_cast<T>(ImmediateDataAddress(cmd)); | 65 return reinterpret_cast<T>(ImmediateDataAddress(cmd)); |
66 } | 66 } |
67 | 67 |
68 void ClearSharedMemory() { | 68 void ClearSharedMemory() { |
69 engine_->ClearSharedMemory(); | 69 engine_->ClearSharedMemory(); |
70 } | 70 } |
71 | 71 |
72 virtual void SetUp() OVERRIDE; | 72 virtual void SetUp() override; |
73 virtual void TearDown() OVERRIDE; | 73 virtual void TearDown() override; |
74 | 74 |
75 template <typename T> | 75 template <typename T> |
76 error::Error ExecuteCmd(const T& cmd) { | 76 error::Error ExecuteCmd(const T& cmd) { |
77 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); | 77 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed); |
78 return decoder_->DoCommands( | 78 return decoder_->DoCommands( |
79 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd)), 0); | 79 1, (const void*)&cmd, ComputeNumEntries(sizeof(cmd)), 0); |
80 } | 80 } |
81 | 81 |
82 template <typename T> | 82 template <typename T> |
83 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) { | 83 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) { |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 EnableFlags enable_flags_; | 550 EnableFlags enable_flags_; |
551 | 551 |
552 private: | 552 private: |
553 class MockCommandBufferEngine : public CommandBufferEngine { | 553 class MockCommandBufferEngine : public CommandBufferEngine { |
554 public: | 554 public: |
555 MockCommandBufferEngine(); | 555 MockCommandBufferEngine(); |
556 | 556 |
557 virtual ~MockCommandBufferEngine(); | 557 virtual ~MockCommandBufferEngine(); |
558 | 558 |
559 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) | 559 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id) |
560 OVERRIDE; | 560 override; |
561 | 561 |
562 void ClearSharedMemory() { | 562 void ClearSharedMemory() { |
563 memset(valid_buffer_->memory(), kInitialMemoryValue, kSharedBufferSize); | 563 memset(valid_buffer_->memory(), kInitialMemoryValue, kSharedBufferSize); |
564 } | 564 } |
565 | 565 |
566 virtual void set_token(int32 token) OVERRIDE; | 566 virtual void set_token(int32 token) override; |
567 | 567 |
568 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE; | 568 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) override; |
569 | 569 |
570 // Overridden from CommandBufferEngine. | 570 // Overridden from CommandBufferEngine. |
571 virtual bool SetGetOffset(int32 offset) OVERRIDE; | 571 virtual bool SetGetOffset(int32 offset) override; |
572 | 572 |
573 // Overridden from CommandBufferEngine. | 573 // Overridden from CommandBufferEngine. |
574 virtual int32 GetGetOffset() OVERRIDE; | 574 virtual int32 GetGetOffset() override; |
575 | 575 |
576 private: | 576 private: |
577 scoped_refptr<gpu::Buffer> valid_buffer_; | 577 scoped_refptr<gpu::Buffer> valid_buffer_; |
578 scoped_refptr<gpu::Buffer> invalid_buffer_; | 578 scoped_refptr<gpu::Buffer> invalid_buffer_; |
579 }; | 579 }; |
580 | 580 |
581 // MockGLStates is used to track GL states and emulate driver | 581 // MockGLStates is used to track GL states and emulate driver |
582 // behaviors on top of MockGLInterface. | 582 // behaviors on top of MockGLInterface. |
583 class MockGLStates { | 583 class MockGLStates { |
584 public: | 584 public: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 MockGLStates gl_states_; | 621 MockGLStates gl_states_; |
622 }; | 622 }; |
623 | 623 |
624 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { | 624 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { |
625 public: | 625 public: |
626 GLES2DecoderWithShaderTestBase() | 626 GLES2DecoderWithShaderTestBase() |
627 : GLES2DecoderTestBase() { | 627 : GLES2DecoderTestBase() { |
628 } | 628 } |
629 | 629 |
630 protected: | 630 protected: |
631 virtual void SetUp() OVERRIDE; | 631 virtual void SetUp() override; |
632 virtual void TearDown() OVERRIDE; | 632 virtual void TearDown() override; |
633 | 633 |
634 }; | 634 }; |
635 | 635 |
636 // SpecializedSetup specializations that are needed in multiple unittest files. | 636 // SpecializedSetup specializations that are needed in multiple unittest files. |
637 template <> | 637 template <> |
638 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); | 638 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); |
639 | 639 |
640 } // namespace gles2 | 640 } // namespace gles2 |
641 } // namespace gpu | 641 } // namespace gpu |
642 | 642 |
643 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 643 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |