OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains unit tests for gles2 commmands | 5 // This file contains unit tests for gles2 commmands |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 namespace gles2 { | 16 namespace gles2 { |
17 | 17 |
18 class GLES2FormatTest : public testing::Test { | 18 class GLES2FormatTest : public testing::Test { |
19 protected: | 19 protected: |
20 static const unsigned char kInitialValue = 0xBD; | 20 static const unsigned char kInitialValue = 0xBD; |
21 | 21 |
22 virtual void SetUp() { | 22 void SetUp() override { memset(buffer_, kInitialValue, sizeof(buffer_)); } |
23 memset(buffer_, kInitialValue, sizeof(buffer_)); | |
24 } | |
25 | 23 |
26 virtual void TearDown() { | 24 void TearDown() override {} |
27 } | |
28 | 25 |
29 template <typename T> | 26 template <typename T> |
30 T* GetBufferAs() { | 27 T* GetBufferAs() { |
31 return static_cast<T*>(static_cast<void*>(&buffer_)); | 28 return static_cast<T*>(static_cast<void*>(&buffer_)); |
32 } | 29 } |
33 | 30 |
34 void CheckBytesWritten( | 31 void CheckBytesWritten( |
35 const void* end, size_t expected_size, size_t written_size) { | 32 const void* end, size_t expected_size, size_t written_size) { |
36 size_t actual_size = static_cast<const unsigned char*>(end) - | 33 size_t actual_size = static_cast<const unsigned char*>(end) - |
37 GetBufferAs<const unsigned char>(); | 34 GetBufferAs<const unsigned char>(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // GCC requires these declarations, but MSVC requires they not be present | 113 // GCC requires these declarations, but MSVC requires they not be present |
117 #ifndef _MSC_VER | 114 #ifndef _MSC_VER |
118 const unsigned char GLES2FormatTest::kInitialValue; | 115 const unsigned char GLES2FormatTest::kInitialValue; |
119 #endif | 116 #endif |
120 | 117 |
121 #include "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h" | 118 #include "gpu/command_buffer/common/gles2_cmd_format_test_autogen.h" |
122 | 119 |
123 } // namespace gles2 | 120 } // namespace gles2 |
124 } // namespace gpu | 121 } // namespace gpu |
125 | 122 |
OLD | NEW |