OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 command_buffer_->Initialize(kBufferSize); | 64 command_buffer_->Initialize(kBufferSize); |
65 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 65 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
66 | 66 |
67 parser_ = new CommandParser(ring_buffer.ptr, | 67 parser_ = new CommandParser(ring_buffer.ptr, |
68 ring_buffer.size, | 68 ring_buffer.size, |
69 0, | 69 0, |
70 ring_buffer.size, | 70 ring_buffer.size, |
71 0, | 71 0, |
72 api_mock_.get()); | 72 api_mock_.get()); |
73 | 73 |
74 gpu_scheduler_.reset(GpuScheduler::CreateForTests( | 74 gpu_scheduler_.reset(new GpuScheduler( |
75 command_buffer_.get(), NULL, parser_)); | 75 command_buffer_.get(), NULL, parser_, INT_MAX)); |
76 command_buffer_->SetPutOffsetChangeCallback(NewCallback( | 76 command_buffer_->SetPutOffsetChangeCallback(NewCallback( |
77 gpu_scheduler_.get(), &GpuScheduler::PutChanged)); | 77 gpu_scheduler_.get(), &GpuScheduler::PutChanged)); |
78 | 78 |
79 api_mock_->set_engine(gpu_scheduler_.get()); | 79 api_mock_->set_engine(gpu_scheduler_.get()); |
80 do_jump_command_.reset(new DoJumpCommand(parser_)); | 80 do_jump_command_.reset(new DoJumpCommand(parser_)); |
81 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) | 81 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) |
82 .WillRepeatedly( | 82 .WillRepeatedly( |
83 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); | 83 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); |
84 | 84 |
85 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 85 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); | 277 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); |
278 | 278 |
279 // Check that the token has indeed passed. | 279 // Check that the token has indeed passed. |
280 EXPECT_LE(tokens[0], GetToken()); | 280 EXPECT_LE(tokens[0], GetToken()); |
281 | 281 |
282 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); | 282 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); |
283 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); | 283 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); |
284 } | 284 } |
285 | 285 |
286 } // namespace gpu | 286 } // namespace gpu |
OLD | NEW |