Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: gpu/command_buffer/client/transfer_buffer_unittest.cc

Issue 10197002: Make transfer buffer reallocate at default size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "gpu/command_buffer/client/client_test_helper.h" 9 #include "gpu/command_buffer/client/client_test_helper.h"
10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 .WillOnce(Return(-1)) 421 .WillOnce(Return(-1))
422 .RetiresOnSaturation(); 422 .RetiresOnSaturation();
423 423
424 const size_t kSize1 = 512 - kStartingOffset; 424 const size_t kSize1 = 512 - kStartingOffset;
425 unsigned int size_allocated = 0; 425 unsigned int size_allocated = 0;
426 void* ptr = transfer_buffer_->AllocUpTo(kSize1, &size_allocated); 426 void* ptr = transfer_buffer_->AllocUpTo(kSize1, &size_allocated);
427 ASSERT_TRUE(ptr == NULL); 427 ASSERT_TRUE(ptr == NULL);
428 EXPECT_FALSE(transfer_buffer_->HaveBuffer()); 428 EXPECT_FALSE(transfer_buffer_->HaveBuffer());
429 } 429 }
430 430
431 TEST_F(TransferBufferExpandContractTest, ReallocsToDefault) {
432 // Free buffer.
433 EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
434 .Times(1)
435 .RetiresOnSaturation();
436 transfer_buffer_->Free();
437 // See it's freed.
438 EXPECT_FALSE(transfer_buffer_->HaveBuffer());
439
440 // See that it gets reallocated.
441 EXPECT_CALL(*command_buffer(),
442 CreateTransferBuffer(kStartTransferBufferSize, _))
vangelis 2012/04/23 23:46:35 Should you pass a size < kStartTransferBufferSize
greggman 2012/04/24 20:04:46 No, the bug was that it was asking for a smaller t
443 .WillOnce(Invoke(
444 command_buffer(),
445 &MockClientCommandBufferCanFail::RealCreateTransferBuffer))
446 .RetiresOnSaturation();
447 EXPECT_EQ(transfer_buffer_id_, transfer_buffer_->GetShmId());
448 EXPECT_TRUE(transfer_buffer_->HaveBuffer());
449
450 // Check it's the default size.
451 EXPECT_EQ(
452 kStartTransferBufferSize - kStartingOffset,
453 transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
454 }
431 455
432 } // namespace gpu 456 } // namespace gpu
433 457
434 458
OLDNEW
« gpu/command_buffer/client/transfer_buffer.cc ('K') | « gpu/command_buffer/client/transfer_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698