| 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 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class BufferTrackerTest : public testing::Test { | 44 class BufferTrackerTest : public testing::Test { |
| 45 protected: | 45 protected: |
| 46 static const int32 kNumCommandEntries = 400; | 46 static const int32 kNumCommandEntries = 400; |
| 47 static const int32 kCommandBufferSizeBytes = | 47 static const int32 kCommandBufferSizeBytes = |
| 48 kNumCommandEntries * sizeof(CommandBufferEntry); | 48 kNumCommandEntries * sizeof(CommandBufferEntry); |
| 49 | 49 |
| 50 virtual void SetUp() { | 50 virtual void SetUp() { |
| 51 command_buffer_.reset(new MockClientCommandBufferImpl()); | 51 command_buffer_.reset(new MockClientCommandBufferImpl()); |
| 52 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); | 52 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); |
| 53 helper_->Initialize(kCommandBufferSizeBytes); | 53 helper_->Initialize(kCommandBufferSizeBytes); |
| 54 mapped_memory_.reset(new MappedMemoryManager(helper_.get())); | 54 mapped_memory_.reset(new MappedMemoryManager( |
| 55 helper_.get(), MappedMemoryManager::kNoLimit)); |
| 55 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); | 56 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); |
| 56 } | 57 } |
| 57 | 58 |
| 58 virtual void TearDown() { | 59 virtual void TearDown() { |
| 59 buffer_tracker_.reset(); | 60 buffer_tracker_.reset(); |
| 60 mapped_memory_.reset(); | 61 mapped_memory_.reset(); |
| 61 helper_.reset(); | 62 helper_.reset(); |
| 62 command_buffer_.reset(); | 63 command_buffer_.reset(); |
| 63 } | 64 } |
| 64 | 65 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Check mapped memory address. | 121 // Check mapped memory address. |
| 121 EXPECT_TRUE(buffer->address() == NULL); | 122 EXPECT_TRUE(buffer->address() == NULL); |
| 122 // Check no shared memory was allocated. | 123 // Check no shared memory was allocated. |
| 123 EXPECT_EQ(0lu, mapped_memory_->num_chunks()); | 124 EXPECT_EQ(0lu, mapped_memory_->num_chunks()); |
| 124 // Check we can delete the buffer. | 125 // Check we can delete the buffer. |
| 125 buffer_tracker_->RemoveBuffer(kId); | 126 buffer_tracker_->RemoveBuffer(kId); |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace gles2 | 129 } // namespace gles2 |
| 129 } // namespace gpu | 130 } // namespace gpu |
| OLD | NEW |