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

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

Issue 375733004: Fixes for re-enabling more MSVC level 4 warnings: gpu/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 6 years, 5 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
« no previous file with comments | « no previous file | gpu/command_buffer/common/id_allocator_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 kTransferBufferSize + 1, &size_allocated); 178 kTransferBufferSize + 1, &size_allocated);
179 ASSERT_TRUE(ptr != NULL); 179 ASSERT_TRUE(ptr != NULL);
180 EXPECT_EQ(kTransferBufferSize - kStartingOffset, size_allocated); 180 EXPECT_EQ(kTransferBufferSize - kStartingOffset, size_allocated);
181 transfer_buffer_->FreePendingToken(ptr, 1); 181 transfer_buffer_->FreePendingToken(ptr, 1);
182 } 182 }
183 183
184 TEST_F(TransferBufferTest, MemoryAlignmentAfterZeroAllocation) { 184 TEST_F(TransferBufferTest, MemoryAlignmentAfterZeroAllocation) {
185 Initialize(32u); 185 Initialize(32u);
186 void* ptr = transfer_buffer_->Alloc(0); 186 void* ptr = transfer_buffer_->Alloc(0);
187 EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u); 187 EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u);
188 transfer_buffer_->FreePendingToken(ptr, -1); 188 transfer_buffer_->FreePendingToken(ptr, static_cast<unsigned int>(-1));
189 // Check that the pointer is aligned on the following allocation. 189 // Check that the pointer is aligned on the following allocation.
190 ptr = transfer_buffer_->Alloc(4); 190 ptr = transfer_buffer_->Alloc(4);
191 EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u); 191 EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u);
192 transfer_buffer_->FreePendingToken(ptr, 1); 192 transfer_buffer_->FreePendingToken(ptr, 1);
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) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/common/id_allocator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698