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 // 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual void SetUp() { |
62 delay_set_token_ = false; | 62 delay_set_token_ = false; |
63 api_mock_.reset(new AsyncAPIMock); | 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))); |
72 | 72 |
73 { | 73 { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |