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

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

Issue 11415223: gpu: Allow BufferData size=0 for pixel transfer buffer objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow BufferTracker::Buffer to be created with zero size. 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 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 BufferTracker. 5 // Tests for the BufferTracker.
6 6
7 #include "gpu/command_buffer/client/buffer_tracker.h" 7 #include "gpu/command_buffer/client/buffer_tracker.h"
8 8
9 #include <GLES2/gl2ext.h> 9 #include <GLES2/gl2ext.h>
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId2) == NULL); 63 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId2) == NULL);
64 // Check we can delete the buffer. 64 // Check we can delete the buffer.
65 buffer_tracker_->RemoveBuffer(kId1); 65 buffer_tracker_->RemoveBuffer(kId1);
66 // Check shared memory was freed. 66 // Check shared memory was freed.
67 mapped_memory_->FreeUnused(); 67 mapped_memory_->FreeUnused();
68 EXPECT_EQ(0lu, mapped_memory_->num_chunks()); 68 EXPECT_EQ(0lu, mapped_memory_->num_chunks());
69 // Check we get nothing for a non-existent buffer. 69 // Check we get nothing for a non-existent buffer.
70 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId1) == NULL); 70 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId1) == NULL);
71 } 71 }
72 72
73 TEST_F(BufferTrackerTest, ZeroSize) {
74 const GLuint kId = 123;
75
76 // Check we can create a Buffer with zero size.
77 BufferTracker::Buffer* buffer = buffer_tracker_->CreateBuffer(kId, 0);
78 ASSERT_TRUE(buffer != NULL);
79 // Check mapped memory address.
80 EXPECT_TRUE(buffer->address() == NULL);
81 // Check no shared memory was allocated.
82 EXPECT_EQ(0lu, mapped_memory_->num_chunks());
83 // Check we can delete the buffer.
84 buffer_tracker_->RemoveBuffer(kId);
85 }
86
73 } // namespace gles2 87 } // namespace gles2
74 } // namespace gpu 88 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/buffer_tracker.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698