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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 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
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 // Tests for the Command Buffer Helper. 5 // Tests for the Command Buffer Helper.
6 6
7 #include "gpu/command_buffer/client/transfer_buffer.h" 7 #include "gpu/command_buffer/client/transfer_buffer.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <memory>
13
12 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
13 #include "gpu/command_buffer/client/client_test_helper.h" 15 #include "gpu/command_buffer/client/client_test_helper.h"
14 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 16 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
15 #include "gpu/command_buffer/common/command_buffer.h" 17 #include "gpu/command_buffer/common/command_buffer.h"
16 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
18 20
19 using ::testing::_; 21 using ::testing::_;
20 using ::testing::AtMost; 22 using ::testing::AtMost;
21 using ::testing::Invoke; 23 using ::testing::Invoke;
(...skipping 27 matching lines...) Expand all
49 kTransferBufferSize, 51 kTransferBufferSize,
50 kTransferBufferSize, 52 kTransferBufferSize,
51 kAlignment, 53 kAlignment,
52 size_to_flush)); 54 size_to_flush));
53 } 55 }
54 56
55 MockClientCommandBufferMockFlush* command_buffer() const { 57 MockClientCommandBufferMockFlush* command_buffer() const {
56 return command_buffer_.get(); 58 return command_buffer_.get();
57 } 59 }
58 60
59 scoped_ptr<MockClientCommandBufferMockFlush> command_buffer_; 61 std::unique_ptr<MockClientCommandBufferMockFlush> command_buffer_;
60 scoped_ptr<CommandBufferHelper> helper_; 62 std::unique_ptr<CommandBufferHelper> helper_;
61 scoped_ptr<TransferBuffer> transfer_buffer_; 63 std::unique_ptr<TransferBuffer> transfer_buffer_;
62 int32_t transfer_buffer_id_; 64 int32_t transfer_buffer_id_;
63 }; 65 };
64 66
65 void TransferBufferTest::SetUp() { 67 void TransferBufferTest::SetUp() {
66 command_buffer_.reset(new StrictMock<MockClientCommandBufferMockFlush>()); 68 command_buffer_.reset(new StrictMock<MockClientCommandBufferMockFlush>());
67 ASSERT_TRUE(command_buffer_->Initialize()); 69 ASSERT_TRUE(command_buffer_->Initialize());
68 70
69 helper_.reset(new CommandBufferHelper(command_buffer())); 71 helper_.reset(new CommandBufferHelper(command_buffer()));
70 ASSERT_TRUE(helper_->Initialize(kCommandBufferSizeBytes)); 72 ASSERT_TRUE(helper_->Initialize(kCommandBufferSizeBytes));
71 73
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 : transfer_buffer_id_(0) { 255 : transfer_buffer_id_(0) {
254 } 256 }
255 257
256 void SetUp() override; 258 void SetUp() override;
257 void TearDown() override; 259 void TearDown() override;
258 260
259 MockClientCommandBufferCanFail* command_buffer() const { 261 MockClientCommandBufferCanFail* command_buffer() const {
260 return command_buffer_.get(); 262 return command_buffer_.get();
261 } 263 }
262 264
263 scoped_ptr<MockClientCommandBufferCanFail> command_buffer_; 265 std::unique_ptr<MockClientCommandBufferCanFail> command_buffer_;
264 scoped_ptr<CommandBufferHelper> helper_; 266 std::unique_ptr<CommandBufferHelper> helper_;
265 scoped_ptr<TransferBuffer> transfer_buffer_; 267 std::unique_ptr<TransferBuffer> transfer_buffer_;
266 int32_t transfer_buffer_id_; 268 int32_t transfer_buffer_id_;
267 }; 269 };
268 270
269 void TransferBufferExpandContractTest::SetUp() { 271 void TransferBufferExpandContractTest::SetUp() {
270 command_buffer_.reset(new StrictMock<MockClientCommandBufferCanFail>()); 272 command_buffer_.reset(new StrictMock<MockClientCommandBufferCanFail>());
271 ASSERT_TRUE(command_buffer_->Initialize()); 273 ASSERT_TRUE(command_buffer_->Initialize());
272 274
273 EXPECT_CALL(*command_buffer(), 275 EXPECT_CALL(*command_buffer(),
274 CreateTransferBuffer(kCommandBufferSizeBytes, _)) 276 CreateTransferBuffer(kCommandBufferSizeBytes, _))
275 .WillOnce(Invoke( 277 .WillOnce(Invoke(
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 483
482 // Check it's the default size. 484 // Check it's the default size.
483 EXPECT_EQ( 485 EXPECT_EQ(
484 kStartTransferBufferSize - kStartingOffset, 486 kStartTransferBufferSize - kStartingOffset,
485 transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc()); 487 transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
486 } 488 }
487 489
488 } // namespace gpu 490 } // namespace gpu
489 491
490 492
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/transfer_buffer.h ('k') | gpu/command_buffer/client/vertex_array_object_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698