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

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

Issue 13454036: Rewrite scoped_array<T> to scoped_ptr<T[]> in gpu/, Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yikes Created 7 years, 8 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 // This file contains the tests for the RingBuffer class. 5 // This file contains the tests for the RingBuffer class.
6 6
7 #include "gpu/command_buffer/client/ring_buffer.h" 7 #include "gpu/command_buffer/client/ring_buffer.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 virtual void TearDown() { 198 virtual void TearDown() {
199 // If the GpuScheduler posts any tasks, this forces them to run. 199 // If the GpuScheduler posts any tasks, this forces them to run.
200 MessageLoop::current()->RunUntilIdle(); 200 MessageLoop::current()->RunUntilIdle();
201 201
202 BaseRingBufferTest::TearDown(); 202 BaseRingBufferTest::TearDown();
203 } 203 }
204 204
205 scoped_ptr<RingBufferWrapper> allocator_; 205 scoped_ptr<RingBufferWrapper> allocator_;
206 scoped_array<int8> buffer_; 206 scoped_ptr<int8[]> buffer_;
207 int8* buffer_start_; 207 int8* buffer_start_;
208 }; 208 };
209 209
210 // Checks basic alloc and free. 210 // Checks basic alloc and free.
211 TEST_F(RingBufferWrapperTest, TestBasic) { 211 TEST_F(RingBufferWrapperTest, TestBasic) {
212 const unsigned int kSize = 16; 212 const unsigned int kSize = 16;
213 void* pointer = allocator_->Alloc(kSize); 213 void* pointer = allocator_->Alloc(kSize);
214 ASSERT_TRUE(pointer); 214 ASSERT_TRUE(pointer);
215 EXPECT_LE(buffer_start_, static_cast<int8*>(pointer)); 215 EXPECT_LE(buffer_start_, static_cast<int8*>(pointer));
216 EXPECT_GE(kBufferSize, static_cast<int8*>(pointer) - buffer_start_ + kSize); 216 EXPECT_GE(kBufferSize, static_cast<int8*>(pointer) - buffer_start_ + kSize);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); 260 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1));
261 261
262 // Check that the token has indeed passed. 262 // Check that the token has indeed passed.
263 EXPECT_LE(tokens[0], GetToken()); 263 EXPECT_LE(tokens[0], GetToken());
264 264
265 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); 265 allocator_->FreePendingToken(pointer1, helper_->InsertToken());
266 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); 266 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken());
267 } 267 }
268 268
269 } // namespace gpu 269 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory_unittest.cc ('k') | gpu/command_buffer/common/command_buffer_shared_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698