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

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

Issue 10440019: Add support for GL_CHROMIUM_pixel_transfer_buffer_object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Tests for the QueryTracker.
6
7 #include "gpu/command_buffer/client/buffer_tracker.h"
8
9 #include <GLES2/gl2ext.h>
10 #include "base/memory/scoped_ptr.h"
11 #include "gpu/command_buffer/client/client_test_helper.h"
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
13 #include "gpu/command_buffer/client/mapped_memory.h"
14 #include "gpu/command_buffer/common/command_buffer.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17
18 namespace gpu {
19 namespace gles2 {
20
21 class BufferTrackerTest : public testing::Test {
22 protected:
23 static const int32 kNumCommandEntries = 400;
24 static const int32 kCommandBufferSizeBytes =
25 kNumCommandEntries * sizeof(CommandBufferEntry);
26
27 virtual void SetUp() {
28 command_buffer_.reset(new MockClientCommandBuffer());
29 helper_.reset(new GLES2CmdHelper(command_buffer_.get()));
30 helper_->Initialize(kCommandBufferSizeBytes);
31 mapped_memory_.reset(new MappedMemoryManager(helper_.get()));
32 buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
33 }
34
35 virtual void TearDown() {
36 buffer_tracker_.reset();
37 mapped_memory_.reset();
38 helper_.reset();
39 command_buffer_.reset();
40 }
41
42 scoped_ptr<CommandBuffer> command_buffer_;
43 scoped_ptr<GLES2CmdHelper> helper_;
44 scoped_ptr<MappedMemoryManager> mapped_memory_;
45 scoped_ptr<BufferTracker> buffer_tracker_;
46 };
47
48 TEST_F(BufferTrackerTest, Basic) {
49 const GLuint kId1 = 123;
50 const GLuint kId2 = 124;
51 const GLsizeiptr size = 64;
52
53 // Check we can create a Buffer.
54 BufferTracker::Buffer* buffer = buffer_tracker_->CreateBuffer(kId1, size);
55 ASSERT_TRUE(buffer != NULL);
56 // Check we can get the same Buffer.
57 EXPECT_EQ(buffer, buffer_tracker_->GetBuffer(kId1));
58 // Check we get nothing for a non-existent buffer.
59 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId2) == NULL);
60 // Check we can delete the buffer.
61 buffer_tracker_->RemoveBuffer(kId1);
62 // Check we get nothing for a non-existent buffer.
63 EXPECT_TRUE(buffer_tracker_->GetBuffer(kId1) == NULL);
64 }
65
66 } // namespace gles2
67 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698