| 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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/mac/scoped_nsautorelease_pool.h" | 8 #include "base/mac/scoped_nsautorelease_pool.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 api_mock_.get()); | 73 api_mock_.get()); |
| 74 | 74 |
| 75 do_jump_command_.reset(new DoJumpCommand(parser_)); | 75 do_jump_command_.reset(new DoJumpCommand(parser_)); |
| 76 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) | 76 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) |
| 77 .WillRepeatedly( | 77 .WillRepeatedly( |
| 78 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); | 78 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); |
| 79 | 79 |
| 80 gpu_scheduler_.reset(new GpuScheduler( | 80 gpu_scheduler_.reset(new GpuScheduler( |
| 81 command_buffer_.get(), NULL, parser_, 1)); | 81 command_buffer_.get(), NULL, parser_, 1)); |
| 82 command_buffer_->SetPutOffsetChangeCallback(NewCallback( | 82 command_buffer_->SetPutOffsetChangeCallback(NewCallback( |
| 83 gpu_scheduler_.get(), &GpuScheduler::ProcessCommands)); | 83 gpu_scheduler_.get(), &GpuScheduler::PutChanged)); |
| 84 | 84 |
| 85 api_mock_->set_engine(gpu_scheduler_.get()); | 85 api_mock_->set_engine(gpu_scheduler_.get()); |
| 86 | 86 |
| 87 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 87 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
| 88 helper_->Initialize(kCommandBufferSizeBytes); | 88 helper_->Initialize(kCommandBufferSizeBytes); |
| 89 } | 89 } |
| 90 | 90 |
| 91 virtual void TearDown() { | 91 virtual void TearDown() { |
| 92 // If the GpuScheduler posts any tasks, this forces them to run. | 92 // If the GpuScheduler posts any tasks, this forces them to run. |
| 93 MessageLoop::current()->RunAllPending(); | 93 MessageLoop::current()->RunAllPending(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 helper_->Finish(); | 301 helper_->Finish(); |
| 302 | 302 |
| 303 // Check that the commands did happen. | 303 // Check that the commands did happen. |
| 304 Mock::VerifyAndClearExpectations(api_mock_.get()); | 304 Mock::VerifyAndClearExpectations(api_mock_.get()); |
| 305 | 305 |
| 306 // Check the error status. | 306 // Check the error status. |
| 307 EXPECT_EQ(error::kNoError, GetError()); | 307 EXPECT_EQ(error::kNoError, GetError()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace gpu | 310 } // namespace gpu |
| OLD | NEW |