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 the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
6 | 6 |
7 #include "gpu/command_buffer/client/transfer_buffer.h" | 7 #include "gpu/command_buffer/client/transfer_buffer.h" |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "gpu/command_buffer/client/client_test_helper.h" | 10 #include "gpu/command_buffer/client/client_test_helper.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 TEST_F(TransferBufferTest, Flush) { | 195 TEST_F(TransferBufferTest, Flush) { |
196 Initialize(16u); | 196 Initialize(16u); |
197 unsigned int size_allocated = 0; | 197 unsigned int size_allocated = 0; |
198 for (int i = 0; i < 8; ++i) { | 198 for (int i = 0; i < 8; ++i) { |
199 void* ptr = transfer_buffer_->AllocUpTo(8u, &size_allocated); | 199 void* ptr = transfer_buffer_->AllocUpTo(8u, &size_allocated); |
200 ASSERT_TRUE(ptr != NULL); | 200 ASSERT_TRUE(ptr != NULL); |
201 EXPECT_EQ(8u, size_allocated); | 201 EXPECT_EQ(8u, size_allocated); |
202 if (i % 2) { | 202 if (i % 2) { |
203 EXPECT_CALL(*command_buffer(), Flush(_)) | 203 EXPECT_CALL(*command_buffer(), Flush(_, _)) |
204 .Times(1) | 204 .Times(1) |
205 .RetiresOnSaturation(); | 205 .RetiresOnSaturation(); |
206 } | 206 } |
207 transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); | 207 transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); |
208 } | 208 } |
209 for (int i = 0; i < 8; ++i) { | 209 for (int i = 0; i < 8; ++i) { |
210 void* ptr = transfer_buffer_->Alloc(8u); | 210 void* ptr = transfer_buffer_->Alloc(8u); |
211 ASSERT_TRUE(ptr != NULL); | 211 ASSERT_TRUE(ptr != NULL); |
212 if (i % 2) { | 212 if (i % 2) { |
213 EXPECT_CALL(*command_buffer(), Flush(_)) | 213 EXPECT_CALL(*command_buffer(), Flush(_, _)) |
214 .Times(1) | 214 .Times(1) |
215 .RetiresOnSaturation(); | 215 .RetiresOnSaturation(); |
216 } | 216 } |
217 transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); | 217 transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 class MockClientCommandBufferCanFail : public MockClientCommandBufferMockFlush { | 221 class MockClientCommandBufferCanFail : public MockClientCommandBufferMockFlush { |
222 public: | 222 public: |
223 MockClientCommandBufferCanFail() { | 223 MockClientCommandBufferCanFail() { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 // Check it's the default size. | 477 // Check it's the default size. |
478 EXPECT_EQ( | 478 EXPECT_EQ( |
479 kStartTransferBufferSize - kStartingOffset, | 479 kStartTransferBufferSize - kStartingOffset, |
480 transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc()); | 480 transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc()); |
481 } | 481 } |
482 | 482 |
483 } // namespace gpu | 483 } // namespace gpu |
484 | 484 |
485 | 485 |
OLD | NEW |