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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 command_buffer_->SetGetBufferChangeCallback(base::Bind( | 85 command_buffer_->SetGetBufferChangeCallback(base::Bind( |
86 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get()))); | 86 &GpuScheduler::SetGetBuffer, base::Unretained(gpu_scheduler_.get()))); |
87 | 87 |
88 api_mock_->set_engine(gpu_scheduler_.get()); | 88 api_mock_->set_engine(gpu_scheduler_.get()); |
89 | 89 |
90 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 90 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
91 helper_->Initialize(kBufferSize); | 91 helper_->Initialize(kBufferSize); |
92 } | 92 } |
93 | 93 |
94 int32 GetToken() { | 94 int32 GetToken() { |
95 return command_buffer_->GetState().token; | 95 return command_buffer_->GetLastState().token; |
96 } | 96 } |
97 | 97 |
98 #if defined(OS_MACOSX) | 98 #if defined(OS_MACOSX) |
99 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 99 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
100 #endif | 100 #endif |
101 base::MessageLoop message_loop_; | 101 base::MessageLoop message_loop_; |
102 scoped_ptr<AsyncAPIMock> api_mock_; | 102 scoped_ptr<AsyncAPIMock> api_mock_; |
103 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 103 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
104 scoped_ptr<CommandBufferService> command_buffer_; | 104 scoped_ptr<CommandBufferService> command_buffer_; |
105 scoped_ptr<GpuScheduler> gpu_scheduler_; | 105 scoped_ptr<GpuScheduler> gpu_scheduler_; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 // This allocation will need to reclaim the space freed above, so that should | 289 // This allocation will need to reclaim the space freed above, so that should |
290 // process the commands until the token is passed. | 290 // process the commands until the token is passed. |
291 void* pointer1 = allocator_->Alloc(kSize); | 291 void* pointer1 = allocator_->Alloc(kSize); |
292 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); | 292 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); |
293 | 293 |
294 // Check that the token has indeed passed. | 294 // Check that the token has indeed passed. |
295 EXPECT_LE(tokens[0], GetToken()); | 295 EXPECT_LE(tokens[0], GetToken()); |
296 | 296 |
297 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); | 297 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); |
298 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); | 298 EXPECT_LE(command_buffer_->GetLastState().token, helper_->InsertToken()); |
299 } | 299 } |
300 | 300 |
301 } // namespace gpu | 301 } // namespace gpu |
OLD | NEW |