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

Side by Side Diff: gpu/command_buffer/service/vertex_attrib_manager_unittest.cc

Issue 10796096: Add tracing of all memory allocated in all contexts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More trybot constructor fixes Created 8 years, 4 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
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 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/common/gl_mock.h" 8 #include "gpu/command_buffer/common/gl_mock.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/test_helper.h" 10 #include "gpu/command_buffer/service/test_helper.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 manager_->Enable(1, false); 105 manager_->Enable(1, false);
106 ASSERT_EQ(1u, infos.size()); 106 ASSERT_EQ(1u, infos.size());
107 EXPECT_FALSE(info1->enabled()); 107 EXPECT_FALSE(info1->enabled());
108 108
109 manager_->Enable(3, false); 109 manager_->Enable(3, false);
110 ASSERT_EQ(0u, infos.size()); 110 ASSERT_EQ(0u, infos.size());
111 EXPECT_FALSE(info2->enabled()); 111 EXPECT_FALSE(info2->enabled());
112 } 112 }
113 113
114 TEST_F(VertexAttribManagerTest, SetAttribInfo) { 114 TEST_F(VertexAttribManagerTest, SetAttribInfo) {
115 BufferManager buffer_manager; 115 BufferManager buffer_manager(NULL);
116 buffer_manager.CreateBufferInfo(1, 2); 116 buffer_manager.CreateBufferInfo(1, 2);
117 BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1); 117 BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1);
118 ASSERT_TRUE(buffer != NULL); 118 ASSERT_TRUE(buffer != NULL);
119 119
120 VertexAttribManager::VertexAttribInfo* info = 120 VertexAttribManager::VertexAttribInfo* info =
121 manager_->GetVertexAttribInfo(1); 121 manager_->GetVertexAttribInfo(1);
122 122
123 manager_->SetAttribInfo(1, buffer, 3, GL_SHORT, GL_TRUE, 32, 32, 4); 123 manager_->SetAttribInfo(1, buffer, 3, GL_SHORT, GL_TRUE, 32, 32, 4);
124 124
125 EXPECT_EQ(buffer, info->buffer()); 125 EXPECT_EQ(buffer, info->buffer());
(...skipping 15 matching lines...) Expand all
141 EXPECT_TRUE(manager_->HaveFixedAttribs()); 141 EXPECT_TRUE(manager_->HaveFixedAttribs());
142 manager_->SetAttribInfo(3, NULL, 4, GL_FIXED, GL_FALSE, 0, 16, 0); 142 manager_->SetAttribInfo(3, NULL, 4, GL_FIXED, GL_FALSE, 0, 16, 0);
143 EXPECT_TRUE(manager_->HaveFixedAttribs()); 143 EXPECT_TRUE(manager_->HaveFixedAttribs());
144 manager_->SetAttribInfo(1, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); 144 manager_->SetAttribInfo(1, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0);
145 EXPECT_TRUE(manager_->HaveFixedAttribs()); 145 EXPECT_TRUE(manager_->HaveFixedAttribs());
146 manager_->SetAttribInfo(3, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0); 146 manager_->SetAttribInfo(3, NULL, 4, GL_FLOAT, GL_FALSE, 0, 16, 0);
147 EXPECT_FALSE(manager_->HaveFixedAttribs()); 147 EXPECT_FALSE(manager_->HaveFixedAttribs());
148 } 148 }
149 149
150 TEST_F(VertexAttribManagerTest, CanAccess) { 150 TEST_F(VertexAttribManagerTest, CanAccess) {
151 BufferManager buffer_manager; 151 BufferManager buffer_manager(NULL);
152 buffer_manager.CreateBufferInfo(1, 2); 152 buffer_manager.CreateBufferInfo(1, 2);
153 BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1); 153 BufferManager::BufferInfo* buffer = buffer_manager.GetBufferInfo(1);
154 ASSERT_TRUE(buffer != NULL); 154 ASSERT_TRUE(buffer != NULL);
155 155
156 VertexAttribManager::VertexAttribInfo* info = 156 VertexAttribManager::VertexAttribInfo* info =
157 manager_->GetVertexAttribInfo(1); 157 manager_->GetVertexAttribInfo(1);
158 158
159 EXPECT_TRUE(info->CanAccess(0)); 159 EXPECT_TRUE(info->CanAccess(0));
160 manager_->Enable(1, true); 160 manager_->Enable(1, true);
161 EXPECT_FALSE(info->CanAccess(0)); 161 EXPECT_FALSE(info->CanAccess(0));
(...skipping 21 matching lines...) Expand all
183 EXPECT_TRUE(info->CanAccess(0)); 183 EXPECT_TRUE(info->CanAccess(0));
184 EXPECT_FALSE(info->CanAccess(1)); 184 EXPECT_FALSE(info->CanAccess(1));
185 185
186 // The VertexAttribManager must be destroyed before the BufferManager 186 // The VertexAttribManager must be destroyed before the BufferManager
187 // so it releases its buffers. 187 // so it releases its buffers.
188 manager_.reset(); 188 manager_.reset();
189 buffer_manager.Destroy(false); 189 buffer_manager.Destroy(false);
190 } 190 }
191 191
192 TEST_F(VertexAttribManagerTest, Unbind) { 192 TEST_F(VertexAttribManagerTest, Unbind) {
193 BufferManager buffer_manager; 193 BufferManager buffer_manager(NULL);
194 buffer_manager.CreateBufferInfo(1, 2); 194 buffer_manager.CreateBufferInfo(1, 2);
195 buffer_manager.CreateBufferInfo(3, 4); 195 buffer_manager.CreateBufferInfo(3, 4);
196 BufferManager::BufferInfo* buffer1 = buffer_manager.GetBufferInfo(1); 196 BufferManager::BufferInfo* buffer1 = buffer_manager.GetBufferInfo(1);
197 BufferManager::BufferInfo* buffer2 = buffer_manager.GetBufferInfo(3); 197 BufferManager::BufferInfo* buffer2 = buffer_manager.GetBufferInfo(3);
198 ASSERT_TRUE(buffer1 != NULL); 198 ASSERT_TRUE(buffer1 != NULL);
199 ASSERT_TRUE(buffer2 != NULL); 199 ASSERT_TRUE(buffer2 != NULL);
200 200
201 VertexAttribManager::VertexAttribInfo* info1 = 201 VertexAttribManager::VertexAttribInfo* info1 =
202 manager_->GetVertexAttribInfo(1); 202 manager_->GetVertexAttribInfo(1);
203 VertexAttribManager::VertexAttribInfo* info3 = 203 VertexAttribManager::VertexAttribInfo* info3 =
(...skipping 19 matching lines...) Expand all
223 // The VertexAttribManager must be destroyed before the BufferManager 223 // The VertexAttribManager must be destroyed before the BufferManager
224 // so it releases its buffers. 224 // so it releases its buffers.
225 manager_.reset(); 225 manager_.reset();
226 buffer_manager.Destroy(false); 226 buffer_manager.Destroy(false);
227 } 227 }
228 228
229 } // namespace gles2 229 } // namespace gles2
230 } // namespace gpu 230 } // namespace gpu
231 231
232 232
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager_unittest.cc ('k') | gpu/command_buffer/tests/gl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698