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

Unified Diff: gpu/command_buffer/client/fenced_allocator_test.cc

Issue 11419280: Make FencedAlloctor fail on size = 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/fenced_allocator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/fenced_allocator_test.cc
diff --git a/gpu/command_buffer/client/fenced_allocator_test.cc b/gpu/command_buffer/client/fenced_allocator_test.cc
index 381237bbe48fd4672a1d5c95cab5b7ea20f2cfba..44fb851e3498d09cdd75974c0f8d33265481e26f 100644
--- a/gpu/command_buffer/client/fenced_allocator_test.cc
+++ b/gpu/command_buffer/client/fenced_allocator_test.cc
@@ -126,6 +126,14 @@ TEST_F(FencedAllocatorTest, TestBasic) {
EXPECT_TRUE(allocator_->CheckConsistency());
}
+// Test alloc 0 fails.
+TEST_F(FencedAllocatorTest, TestAllocZero) {
+ FencedAllocator::Offset offset = allocator_->Alloc(0);
+ EXPECT_EQ(FencedAllocator::kInvalidOffset, offset);
+ EXPECT_FALSE(allocator_->InUse());
+ EXPECT_TRUE(allocator_->CheckConsistency());
+}
+
// Checks out-of-memory condition.
TEST_F(FencedAllocatorTest, TestOutOfMemory) {
EXPECT_TRUE(allocator_->CheckConsistency());
@@ -446,6 +454,15 @@ TEST_F(FencedAllocatorWrapperTest, TestBasic) {
allocator_->Free(pointer_uint);
}
+// Test alloc 0 fails.
+TEST_F(FencedAllocatorWrapperTest, TestAllocZero) {
+ allocator_->CheckConsistency();
+
+ void *pointer = allocator_->Alloc(0);
+ ASSERT_FALSE(pointer);
+ EXPECT_TRUE(allocator_->CheckConsistency());
+}
+
// Checks out-of-memory condition.
TEST_F(FencedAllocatorWrapperTest, TestOutOfMemory) {
allocator_->CheckConsistency();
« no previous file with comments | « gpu/command_buffer/client/fenced_allocator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698