| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // certain commands. | 63 // certain commands. |
| 64 template <typename T, int id> | 64 template <typename T, int id> |
| 65 void SpecializedSetup(bool valid) { | 65 void SpecializedSetup(bool valid) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 template <typename T> | 68 template <typename T> |
| 69 T* GetImmediateAs() { | 69 T* GetImmediateAs() { |
| 70 return reinterpret_cast<T*>(immediate_buffer_); | 70 return reinterpret_cast<T*>(immediate_buffer_); |
| 71 } | 71 } |
| 72 | 72 |
| 73 template <typename T, typename Command> | |
| 74 T GetImmediateDataAs(Command* cmd) { | |
| 75 return reinterpret_cast<T>(ImmediateDataAddress(cmd)); | |
| 76 } | |
| 77 | |
| 78 void ClearSharedMemory() { | 73 void ClearSharedMemory() { |
| 79 engine_->ClearSharedMemory(); | 74 engine_->ClearSharedMemory(); |
| 80 } | 75 } |
| 81 | 76 |
| 82 void SetUp() override; | 77 void SetUp() override; |
| 83 void TearDown() override; | 78 void TearDown() override; |
| 84 | 79 |
| 85 template <typename T> | 80 template <typename T> |
| 86 error::Error ExecuteCmd(const T& cmd) { | 81 error::Error ExecuteCmd(const T& cmd) { |
| 87 static_assert(T::kArgFlags == cmd::kFixed, | 82 static_assert(T::kArgFlags == cmd::kFixed, |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 759 |
| 765 protected: | 760 protected: |
| 766 void SetUp() override; | 761 void SetUp() override; |
| 767 void TearDown() override; | 762 void TearDown() override; |
| 768 }; | 763 }; |
| 769 | 764 |
| 770 // SpecializedSetup specializations that are needed in multiple unittest files. | 765 // SpecializedSetup specializations that are needed in multiple unittest files. |
| 771 template <> | 766 template <> |
| 772 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); | 767 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); |
| 773 | 768 |
| 769 MATCHER_P2(PointsToArray, array, size, "") { |
| 770 for (size_t i = 0; i < static_cast<size_t>(size); ++i) { |
| 771 if (arg[i] != array[i]) |
| 772 return false; |
| 773 } |
| 774 return true; |
| 775 } |
| 776 |
| 774 } // namespace gles2 | 777 } // namespace gles2 |
| 775 } // namespace gpu | 778 } // namespace gpu |
| 776 | 779 |
| 777 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 780 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| OLD | NEW |