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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
9 #include "gpu/GLES2/gles2_command_buffer.h" | 9 #include "gpu/GLES2/gles2_command_buffer.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 virtual Buffer GetRingBuffer() { | 41 virtual Buffer GetRingBuffer() { |
42 return ring_buffer_buffer_; | 42 return ring_buffer_buffer_; |
43 } | 43 } |
44 | 44 |
45 virtual State GetState() { | 45 virtual State GetState() { |
46 return state_; | 46 return state_; |
47 } | 47 } |
48 | 48 |
| 49 virtual State GetLastState() { |
| 50 return state_; |
| 51 } |
| 52 |
49 virtual void Flush(int32 put_offset) { | 53 virtual void Flush(int32 put_offset) { |
50 state_.put_offset = put_offset; | 54 state_.put_offset = put_offset; |
51 } | 55 } |
52 | 56 |
53 virtual State FlushSync(int32 put_offset, int32 last_known_get) { | 57 virtual State FlushSync(int32 put_offset, int32 last_known_get) { |
54 state_.put_offset = put_offset; | 58 state_.put_offset = put_offset; |
55 state_.get_offset = put_offset; | 59 state_.get_offset = put_offset; |
56 OnFlush(transfer_buffer_buffer_.ptr); | 60 OnFlush(transfer_buffer_buffer_.ptr); |
57 | 61 |
58 return state_; | 62 return state_; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 GetNextToken(); // eat the token that starting up will use. | 250 GetNextToken(); // eat the token that starting up will use. |
247 | 251 |
248 gl_.reset(new GLES2Implementation( | 252 gl_.reset(new GLES2Implementation( |
249 helper_.get(), | 253 helper_.get(), |
250 kTransferBufferSize, | 254 kTransferBufferSize, |
251 transfer_buffer_.ptr, | 255 transfer_buffer_.ptr, |
252 kTransferBufferId, | 256 kTransferBufferId, |
253 false)); | 257 false)); |
254 | 258 |
255 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); | 259 EXPECT_CALL(*command_buffer_, OnFlush(_)).Times(1).RetiresOnSaturation(); |
256 helper_->CommandBufferHelper::FlushSync(); | 260 helper_->CommandBufferHelper::Finish(); |
257 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 261 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
258 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + | 262 commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + |
259 command_buffer_->GetState().put_offset; | 263 command_buffer_->GetState().put_offset; |
260 ClearCommands(); | 264 ClearCommands(); |
261 } | 265 } |
262 | 266 |
263 virtual void TearDown() { | 267 virtual void TearDown() { |
264 } | 268 } |
265 | 269 |
266 void ClearCommands() { | 270 void ClearCommands() { |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 EXPECT_TRUE(NoCommandsWritten()); | 1144 EXPECT_TRUE(NoCommandsWritten()); |
1141 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), gl_->GetError()); | 1145 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), gl_->GetError()); |
1142 EXPECT_EQ(0, results[0]); | 1146 EXPECT_EQ(0, results[0]); |
1143 EXPECT_EQ(kSentinel, results[num_results]); | 1147 EXPECT_EQ(kSentinel, results[num_results]); |
1144 } | 1148 } |
1145 | 1149 |
1146 } // namespace gles2 | 1150 } // namespace gles2 |
1147 } // namespace gpu | 1151 } // namespace gpu |
1148 | 1152 |
1149 | 1153 |
OLD | NEW |