| OLD | NEW |
| 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 // This file contains the tests for the FencedAllocator class. | 5 // This file contains the tests for the FencedAllocator class. |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 virtual void TearDown() { | 410 virtual void TearDown() { |
| 411 // If the GpuScheduler posts any tasks, this forces them to run. | 411 // If the GpuScheduler posts any tasks, this forces them to run. |
| 412 MessageLoop::current()->RunUntilIdle(); | 412 MessageLoop::current()->RunUntilIdle(); |
| 413 | 413 |
| 414 EXPECT_TRUE(allocator_->CheckConsistency()); | 414 EXPECT_TRUE(allocator_->CheckConsistency()); |
| 415 | 415 |
| 416 BaseFencedAllocatorTest::TearDown(); | 416 BaseFencedAllocatorTest::TearDown(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 scoped_ptr<FencedAllocatorWrapper> allocator_; | 419 scoped_ptr<FencedAllocatorWrapper> allocator_; |
| 420 scoped_array<char> buffer_; | 420 scoped_ptr<char[]> buffer_; |
| 421 }; | 421 }; |
| 422 | 422 |
| 423 // Checks basic alloc and free. | 423 // Checks basic alloc and free. |
| 424 TEST_F(FencedAllocatorWrapperTest, TestBasic) { | 424 TEST_F(FencedAllocatorWrapperTest, TestBasic) { |
| 425 allocator_->CheckConsistency(); | 425 allocator_->CheckConsistency(); |
| 426 | 426 |
| 427 const unsigned int kSize = 16; | 427 const unsigned int kSize = 16; |
| 428 void *pointer = allocator_->Alloc(kSize); | 428 void *pointer = allocator_->Alloc(kSize); |
| 429 ASSERT_TRUE(pointer); | 429 ASSERT_TRUE(pointer); |
| 430 EXPECT_LE(buffer_.get(), static_cast<char *>(pointer)); | 430 EXPECT_LE(buffer_.get(), static_cast<char *>(pointer)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 EXPECT_LE(token, GetToken()); | 543 EXPECT_LE(token, GetToken()); |
| 544 | 544 |
| 545 // Free up everything. | 545 // Free up everything. |
| 546 for (unsigned int i = 0; i < kAllocCount; ++i) { | 546 for (unsigned int i = 0; i < kAllocCount; ++i) { |
| 547 allocator_->Free(pointers[i]); | 547 allocator_->Free(pointers[i]); |
| 548 EXPECT_TRUE(allocator_->CheckConsistency()); | 548 EXPECT_TRUE(allocator_->CheckConsistency()); |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 } // namespace gpu | 552 } // namespace gpu |
| OLD | NEW |