| 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 <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
| 10 #include "gpu/command_buffer/client/client_test_helper.h" | 10 #include "gpu/command_buffer/client/client_test_helper.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 virtual ~MockTransferBuffer() { } | 112 virtual ~MockTransferBuffer() { } |
| 113 | 113 |
| 114 bool Initialize( | 114 bool Initialize( |
| 115 unsigned int starting_buffer_size, | 115 unsigned int starting_buffer_size, |
| 116 unsigned int result_size, | 116 unsigned int result_size, |
| 117 unsigned int /* min_buffer_size */, | 117 unsigned int /* min_buffer_size */, |
| 118 unsigned int /* max_buffer_size */, | 118 unsigned int /* max_buffer_size */, |
| 119 unsigned int alignment) OVERRIDE; | 119 unsigned int alignment, |
| 120 unsigned int size_to_flush) OVERRIDE; |
| 120 virtual int GetShmId() OVERRIDE; | 121 virtual int GetShmId() OVERRIDE; |
| 121 virtual void* GetResultBuffer() OVERRIDE; | 122 virtual void* GetResultBuffer() OVERRIDE; |
| 122 virtual int GetResultOffset() OVERRIDE; | 123 virtual int GetResultOffset() OVERRIDE; |
| 123 virtual void Free() OVERRIDE; | 124 virtual void Free() OVERRIDE; |
| 124 virtual bool HaveBuffer() const OVERRIDE; | 125 virtual bool HaveBuffer() const OVERRIDE; |
| 125 virtual void* AllocUpTo( | 126 virtual void* AllocUpTo( |
| 126 unsigned int size, unsigned int* size_allocated) OVERRIDE; | 127 unsigned int size, unsigned int* size_allocated) OVERRIDE; |
| 127 virtual void* Alloc(unsigned int size) OVERRIDE; | 128 virtual void* Alloc(unsigned int size) OVERRIDE; |
| 128 virtual RingBuffer::Offset GetOffset(void* pointer) const OVERRIDE; | 129 virtual RingBuffer::Offset GetOffset(void* pointer) const OVERRIDE; |
| 129 virtual void FreePendingToken(void* p, unsigned int /* token */) OVERRIDE; | 130 virtual void FreePendingToken(void* p, unsigned int /* token */) OVERRIDE; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 uint32 actual_offset_; | 218 uint32 actual_offset_; |
| 218 | 219 |
| 219 DISALLOW_COPY_AND_ASSIGN(MockTransferBuffer); | 220 DISALLOW_COPY_AND_ASSIGN(MockTransferBuffer); |
| 220 }; | 221 }; |
| 221 | 222 |
| 222 bool MockTransferBuffer::Initialize( | 223 bool MockTransferBuffer::Initialize( |
| 223 unsigned int starting_buffer_size, | 224 unsigned int starting_buffer_size, |
| 224 unsigned int result_size, | 225 unsigned int result_size, |
| 225 unsigned int /* min_buffer_size */, | 226 unsigned int /* min_buffer_size */, |
| 226 unsigned int /* max_buffer_size */, | 227 unsigned int /* max_buffer_size */, |
| 227 unsigned int alignment) { | 228 unsigned int alignment, |
| 229 unsigned int /* size_to_flush */) { |
| 228 // Just check they match. | 230 // Just check they match. |
| 229 return size_ == starting_buffer_size && | 231 return size_ == starting_buffer_size && |
| 230 result_size_ == result_size && | 232 result_size_ == result_size && |
| 231 alignment_ == alignment; | 233 alignment_ == alignment; |
| 232 }; | 234 }; |
| 233 | 235 |
| 234 int MockTransferBuffer::GetShmId() { | 236 int MockTransferBuffer::GetShmId() { |
| 235 return buffer_ids_[actual_buffer_index_]; | 237 return buffer_ids_[actual_buffer_index_]; |
| 236 } | 238 } |
| 237 | 239 |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 gl_->BufferData(GL_ARRAY_BUFFER, arraysize(buf), buf, GL_DYNAMIC_DRAW); | 2141 gl_->BufferData(GL_ARRAY_BUFFER, arraysize(buf), buf, GL_DYNAMIC_DRAW); |
| 2140 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 2142 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 2141 } | 2143 } |
| 2142 | 2144 |
| 2143 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 2145 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
| 2144 | 2146 |
| 2145 } // namespace gles2 | 2147 } // namespace gles2 |
| 2146 } // namespace gpu | 2148 } // namespace gpu |
| 2147 | 2149 |
| 2148 | 2150 |
| OLD | NEW |