| 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/client_test_helper.h" | 7 #include "gpu/command_buffer/client/client_test_helper.h" |
| 8 | 8 |
| 9 #include "gpu/command_buffer/common/command_buffer.h" | 9 #include "gpu/command_buffer/common/command_buffer.h" |
| 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 CommandBuffer::State MockCommandBufferBase::GetState() { | 25 CommandBuffer::State MockCommandBufferBase::GetState() { |
| 26 return state_; | 26 return state_; |
| 27 } | 27 } |
| 28 | 28 |
| 29 CommandBuffer::State MockCommandBufferBase::GetLastState() { | 29 CommandBuffer::State MockCommandBufferBase::GetLastState() { |
| 30 return state_; | 30 return state_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void MockCommandBufferBase::Flush(int32 put_offset) { | |
| 34 state_.put_offset = put_offset; | |
| 35 } | |
| 36 | |
| 37 void MockCommandBufferBase::SetGetOffset(int32 get_offset) { | 33 void MockCommandBufferBase::SetGetOffset(int32 get_offset) { |
| 38 state_.get_offset = get_offset; | 34 state_.get_offset = get_offset; |
| 39 } | 35 } |
| 40 | 36 |
| 41 CommandBuffer::State MockCommandBufferBase::FlushSync( | 37 CommandBuffer::State MockCommandBufferBase::FlushSync( |
| 42 int32 put_offset, int32 last_known_get) { | 38 int32 put_offset, int32 last_known_get) { |
| 43 state_.put_offset = put_offset; | 39 state_.put_offset = put_offset; |
| 44 state_.get_offset = put_offset; | 40 state_.get_offset = put_offset; |
| 45 OnFlush(); | 41 OnFlush(); |
| 46 return state_; | 42 return state_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 87 } |
| 92 | 88 |
| 93 int32 MockCommandBufferBase::RegisterTransferBuffer( | 89 int32 MockCommandBufferBase::RegisterTransferBuffer( |
| 94 base::SharedMemory* shared_memory, | 90 base::SharedMemory* shared_memory, |
| 95 size_t size, | 91 size_t size, |
| 96 int32 id_request) { | 92 int32 id_request) { |
| 97 GPU_NOTREACHED(); | 93 GPU_NOTREACHED(); |
| 98 return -1; | 94 return -1; |
| 99 } | 95 } |
| 100 | 96 |
| 97 void MockCommandBufferBase::FlushHelper(int32 put_offset) { |
| 98 state_.put_offset = put_offset; |
| 99 } |
| 100 |
| 101 void MockCommandBufferBase::SetToken(int32 token) { | 101 void MockCommandBufferBase::SetToken(int32 token) { |
| 102 GPU_NOTREACHED(); | 102 GPU_NOTREACHED(); |
| 103 state_.token = token; | 103 state_.token = token; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void MockCommandBufferBase::SetParseError(error::Error error) { | 106 void MockCommandBufferBase::SetParseError(error::Error error) { |
| 107 GPU_NOTREACHED(); | 107 GPU_NOTREACHED(); |
| 108 state_.error = error; | 108 state_.error = error; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void MockCommandBufferBase::SetContextLostReason( | 111 void MockCommandBufferBase::SetContextLostReason( |
| 112 error::ContextLostReason reason) { | 112 error::ContextLostReason reason) { |
| 113 GPU_NOTREACHED(); | 113 GPU_NOTREACHED(); |
| 114 state_.context_lost_reason = reason; | 114 state_.context_lost_reason = reason; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // GCC requires these declarations, but MSVC requires they not be present | 117 // GCC requires these declarations, but MSVC requires they not be present |
| 118 #ifndef _MSC_VER | 118 #ifndef _MSC_VER |
| 119 const int32 MockCommandBufferBase::kTransferBufferBaseId; | 119 const int32 MockCommandBufferBase::kTransferBufferBaseId; |
| 120 const int32 MockCommandBufferBase::kMaxTransferBuffers; | 120 const int32 MockCommandBufferBase::kMaxTransferBuffers; |
| 121 #endif | 121 #endif |
| 122 | 122 |
| 123 MockClientCommandBuffer::MockClientCommandBuffer() { | 123 MockClientCommandBuffer::MockClientCommandBuffer() { |
| 124 DelegateToFake(); | 124 DelegateToFake(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 MockClientCommandBuffer::~MockClientCommandBuffer() { | 127 MockClientCommandBuffer::~MockClientCommandBuffer() { |
| 128 } | 128 } |
| 129 | 129 |
| 130 void MockClientCommandBuffer::Flush(int32 put_offset) { |
| 131 FlushHelper(put_offset); |
| 132 } |
| 133 |
| 130 void MockClientCommandBuffer::DelegateToFake() { | 134 void MockClientCommandBuffer::DelegateToFake() { |
| 131 ON_CALL(*this, DestroyTransferBuffer(_)) | 135 ON_CALL(*this, DestroyTransferBuffer(_)) |
| 132 .WillByDefault(Invoke( | 136 .WillByDefault(Invoke( |
| 133 this, &MockCommandBufferBase::DestroyTransferBufferHelper)); | 137 this, &MockCommandBufferBase::DestroyTransferBufferHelper)); |
| 134 } | 138 } |
| 135 | 139 |
| 140 MockClientCommandBufferMockFlush::MockClientCommandBufferMockFlush() { |
| 141 DelegateToFake(); |
| 142 } |
| 143 |
| 144 MockClientCommandBufferMockFlush::~MockClientCommandBufferMockFlush() { |
| 145 } |
| 146 |
| 147 void MockClientCommandBufferMockFlush::DelegateToFake() { |
| 148 MockClientCommandBuffer::DelegateToFake(); |
| 149 ON_CALL(*this, Flush(_)) |
| 150 .WillByDefault(Invoke( |
| 151 this, &MockCommandBufferBase::FlushHelper)); |
| 152 } |
| 153 |
| 136 } // namespace gpu | 154 } // namespace gpu |
| 137 | 155 |
| 138 | 156 |
| OLD | NEW |