Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / gpu / command_buffer / client / transfer_buffer_unittest.cc
index 7201477..9f3b51e 100644 (file)
@@ -181,6 +181,17 @@ TEST_F(TransferBufferTest, TooLargeAllocation) {
   transfer_buffer_->FreePendingToken(ptr, 1);
 }
 
+TEST_F(TransferBufferTest, MemoryAlignmentAfterZeroAllocation) {
+  Initialize(32u);
+  void* ptr = transfer_buffer_->Alloc(0);
+  EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u);
+  transfer_buffer_->FreePendingToken(ptr, -1);
+  // Check that the pointer is aligned on the following allocation.
+  ptr = transfer_buffer_->Alloc(4);
+  EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u);
+  transfer_buffer_->FreePendingToken(ptr, 1);
+}
+
 TEST_F(TransferBufferTest, Flush) {
   Initialize(16u);
   unsigned int size_allocated = 0;