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 QueryTracker. | 5 // Tests for the QueryTracker. |
6 | 6 |
7 #include "gpu/command_buffer/client/query_tracker.h" | 7 #include "gpu/command_buffer/client/query_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" |
11 #include "gpu/command_buffer/client/client_test_helper.h" | 11 #include "gpu/command_buffer/client/client_test_helper.h" |
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
13 #include "gpu/command_buffer/client/mapped_memory.h" | 13 #include "gpu/command_buffer/client/mapped_memory.h" |
14 #include "gpu/command_buffer/common/command_buffer.h" | 14 #include "gpu/command_buffer/common/command_buffer.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 namespace gles2 { | 19 namespace gles2 { |
20 | 20 |
| 21 namespace { |
| 22 void EmptyPoll() { |
| 23 } |
| 24 } |
| 25 |
21 class QuerySyncManagerTest : public testing::Test { | 26 class QuerySyncManagerTest : public testing::Test { |
22 protected: | 27 protected: |
23 static const int32 kNumCommandEntries = 400; | 28 static const int32 kNumCommandEntries = 400; |
24 static const int32 kCommandBufferSizeBytes = | 29 static const int32 kCommandBufferSizeBytes = |
25 kNumCommandEntries * sizeof(CommandBufferEntry); | 30 kNumCommandEntries * sizeof(CommandBufferEntry); |
26 | 31 |
27 virtual void SetUp() { | 32 virtual void SetUp() { |
28 command_buffer_.reset(new MockClientCommandBuffer()); | 33 command_buffer_.reset(new MockClientCommandBuffer()); |
29 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); | 34 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); |
30 helper_->Initialize(kCommandBufferSizeBytes); | 35 helper_->Initialize(kCommandBufferSizeBytes); |
31 mapped_memory_.reset(new MappedMemoryManager( | 36 mapped_memory_.reset(new MappedMemoryManager( |
32 helper_.get(), MappedMemoryManager::kNoLimit)); | 37 helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); |
33 sync_manager_.reset(new QuerySyncManager(mapped_memory_.get())); | 38 sync_manager_.reset(new QuerySyncManager(mapped_memory_.get())); |
34 } | 39 } |
35 | 40 |
36 virtual void TearDown() { | 41 virtual void TearDown() { |
37 sync_manager_.reset(); | 42 sync_manager_.reset(); |
38 mapped_memory_.reset(); | 43 mapped_memory_.reset(); |
39 helper_.reset(); | 44 helper_.reset(); |
40 command_buffer_.reset(); | 45 command_buffer_.reset(); |
41 } | 46 } |
42 | 47 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 protected: | 81 protected: |
77 static const int32 kNumCommandEntries = 400; | 82 static const int32 kNumCommandEntries = 400; |
78 static const int32 kCommandBufferSizeBytes = | 83 static const int32 kCommandBufferSizeBytes = |
79 kNumCommandEntries * sizeof(CommandBufferEntry); | 84 kNumCommandEntries * sizeof(CommandBufferEntry); |
80 | 85 |
81 virtual void SetUp() { | 86 virtual void SetUp() { |
82 command_buffer_.reset(new MockClientCommandBuffer()); | 87 command_buffer_.reset(new MockClientCommandBuffer()); |
83 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); | 88 helper_.reset(new GLES2CmdHelper(command_buffer_.get())); |
84 helper_->Initialize(kCommandBufferSizeBytes); | 89 helper_->Initialize(kCommandBufferSizeBytes); |
85 mapped_memory_.reset(new MappedMemoryManager( | 90 mapped_memory_.reset(new MappedMemoryManager( |
86 helper_.get(), MappedMemoryManager::kNoLimit)); | 91 helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); |
87 query_tracker_.reset(new QueryTracker(mapped_memory_.get())); | 92 query_tracker_.reset(new QueryTracker(mapped_memory_.get())); |
88 } | 93 } |
89 | 94 |
90 virtual void TearDown() { | 95 virtual void TearDown() { |
91 query_tracker_.reset(); | 96 query_tracker_.reset(); |
92 mapped_memory_.reset(); | 97 mapped_memory_.reset(); |
93 helper_.reset(); | 98 helper_.reset(); |
94 command_buffer_.reset(); | 99 command_buffer_.reset(); |
95 } | 100 } |
96 | 101 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 206 |
202 // Check FreeCompletedQueries. | 207 // Check FreeCompletedQueries. |
203 query_tracker_->FreeCompletedQueries(); | 208 query_tracker_->FreeCompletedQueries(); |
204 EXPECT_EQ(0u, bucket->used_query_count); | 209 EXPECT_EQ(0u, bucket->used_query_count); |
205 } | 210 } |
206 | 211 |
207 } // namespace gles2 | 212 } // namespace gles2 |
208 } // namespace gpu | 213 } // namespace gpu |
209 | 214 |
210 | 215 |
OLD | NEW |