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

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

Issue 682743002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 // 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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 unsigned int arg_count, 51 unsigned int arg_count,
52 const void* _args) { 52 const void* _args) {
53 EXPECT_EQ(static_cast<unsigned int>(cmd::kSetToken), command); 53 EXPECT_EQ(static_cast<unsigned int>(cmd::kSetToken), command);
54 EXPECT_EQ(1u, arg_count); 54 EXPECT_EQ(1u, arg_count);
55 if (delay_set_token_) 55 if (delay_set_token_)
56 set_token_arguments_.push_back(_args); 56 set_token_arguments_.push_back(_args);
57 else 57 else
58 api_mock_->SetToken(cmd::kSetToken, 1, _args); 58 api_mock_->SetToken(cmd::kSetToken, 1, _args);
59 } 59 }
60 60
61 virtual void SetUp() { 61 void SetUp() override {
62 delay_set_token_ = false; 62 delay_set_token_ = false;
63 api_mock_.reset(new AsyncAPIMock(true)); 63 api_mock_.reset(new AsyncAPIMock(true));
64 // ignore noops in the mock - we don't want to inspect the internals of the 64 // ignore noops in the mock - we don't want to inspect the internals of the
65 // helper. 65 // helper.
66 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) 66 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _))
67 .WillRepeatedly(Return(error::kNoError)); 67 .WillRepeatedly(Return(error::kNoError));
68 // Forward the SetToken calls to the engine 68 // Forward the SetToken calls to the engine
69 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) 69 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _))
70 .WillRepeatedly(DoAll(Invoke(this, &BaseRingBufferTest::SetToken), 70 .WillRepeatedly(DoAll(Invoke(this, &BaseRingBufferTest::SetToken),
71 Return(error::kNoError))); 71 Return(error::kNoError)));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 const unsigned int BaseRingBufferTest::kBaseOffset; 116 const unsigned int BaseRingBufferTest::kBaseOffset;
117 const unsigned int BaseRingBufferTest::kBufferSize; 117 const unsigned int BaseRingBufferTest::kBufferSize;
118 #endif 118 #endif
119 119
120 // Test fixture for RingBuffer test - Creates a RingBuffer, using a 120 // Test fixture for RingBuffer test - Creates a RingBuffer, using a
121 // CommandBufferHelper with a mock AsyncAPIInterface for its interface (calling 121 // CommandBufferHelper with a mock AsyncAPIInterface for its interface (calling
122 // it directly, not through the RPC mechanism), making sure Noops are ignored 122 // it directly, not through the RPC mechanism), making sure Noops are ignored
123 // and SetToken are properly forwarded to the engine. 123 // and SetToken are properly forwarded to the engine.
124 class RingBufferTest : public BaseRingBufferTest { 124 class RingBufferTest : public BaseRingBufferTest {
125 protected: 125 protected:
126 virtual void SetUp() { 126 void SetUp() override {
127 BaseRingBufferTest::SetUp(); 127 BaseRingBufferTest::SetUp();
128 128
129 buffer_.reset(new int8[kBufferSize + kBaseOffset]); 129 buffer_.reset(new int8[kBufferSize + kBaseOffset]);
130 buffer_start_ = buffer_.get() + kBaseOffset; 130 buffer_start_ = buffer_.get() + kBaseOffset;
131 allocator_.reset(new RingBuffer(kAlignment, kBaseOffset, kBufferSize, 131 allocator_.reset(new RingBuffer(kAlignment, kBaseOffset, kBufferSize,
132 helper_.get(), buffer_start_)); 132 helper_.get(), buffer_start_));
133 } 133 }
134 134
135 virtual void TearDown() { 135 void TearDown() override {
136 // If the GpuScheduler posts any tasks, this forces them to run. 136 // If the GpuScheduler posts any tasks, this forces them to run.
137 base::MessageLoop::current()->RunUntilIdle(); 137 base::MessageLoop::current()->RunUntilIdle();
138 138
139 BaseRingBufferTest::TearDown(); 139 BaseRingBufferTest::TearDown();
140 } 140 }
141 141
142 scoped_ptr<RingBuffer> allocator_; 142 scoped_ptr<RingBuffer> allocator_;
143 }; 143 };
144 144
145 // Checks basic alloc and free. 145 // Checks basic alloc and free.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 pointer = allocator_->Alloc(kAlloc2); 207 pointer = allocator_->Alloc(kAlloc2);
208 EXPECT_EQ(kBufferSize - kAlloc1 - kAlloc2, 208 EXPECT_EQ(kBufferSize - kAlloc1 - kAlloc2,
209 allocator_->GetLargestFreeSizeNoWaiting()); 209 allocator_->GetLargestFreeSizeNoWaiting());
210 allocator_->FreePendingToken(pointer, helper_.get()->InsertToken()); 210 allocator_->FreePendingToken(pointer, helper_.get()->InsertToken());
211 pointer = allocator_->Alloc(kBufferSize); 211 pointer = allocator_->Alloc(kBufferSize);
212 EXPECT_EQ(0u, allocator_->GetLargestFreeSizeNoWaiting()); 212 EXPECT_EQ(0u, allocator_->GetLargestFreeSizeNoWaiting());
213 allocator_->FreePendingToken(pointer, helper_.get()->InsertToken()); 213 allocator_->FreePendingToken(pointer, helper_.get()->InsertToken());
214 } 214 }
215 215
216 } // namespace gpu 216 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/query_tracker_unittest.cc ('k') | gpu/command_buffer/client/transfer_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698