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/bind.h" |
| 8 #include "base/bind_helpers.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
10 #include "gpu/command_buffer/service/mocks.h" | 11 #include "gpu/command_buffer/service/mocks.h" |
11 #include "gpu/command_buffer/service/command_buffer_service.h" | 12 #include "gpu/command_buffer/service/command_buffer_service.h" |
12 #include "gpu/command_buffer/service/gpu_scheduler.h" | 13 #include "gpu/command_buffer/service/gpu_scheduler.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
16 #include "base/mac/scoped_nsautorelease_pool.h" | 17 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #endif | 18 #endif |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 0, | 76 0, |
76 api_mock_.get()); | 77 api_mock_.get()); |
77 | 78 |
78 do_jump_command_.reset(new DoJumpCommand(parser_)); | 79 do_jump_command_.reset(new DoJumpCommand(parser_)); |
79 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) | 80 EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _)) |
80 .WillRepeatedly( | 81 .WillRepeatedly( |
81 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); | 82 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); |
82 | 83 |
83 gpu_scheduler_.reset(new GpuScheduler( | 84 gpu_scheduler_.reset(new GpuScheduler( |
84 command_buffer_.get(), NULL, parser_)); | 85 command_buffer_.get(), NULL, parser_)); |
85 command_buffer_->SetPutOffsetChangeCallback(NewCallback( | 86 command_buffer_->SetPutOffsetChangeCallback(base::Bind( |
86 gpu_scheduler_.get(), &GpuScheduler::PutChanged)); | 87 &GpuScheduler::PutChanged, base::Unretained(gpu_scheduler_.get()))); |
87 | 88 |
88 api_mock_->set_engine(gpu_scheduler_.get()); | 89 api_mock_->set_engine(gpu_scheduler_.get()); |
89 | 90 |
90 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 91 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
91 helper_->Initialize(kCommandBufferSizeBytes); | 92 helper_->Initialize(kCommandBufferSizeBytes); |
92 } | 93 } |
93 | 94 |
94 virtual void TearDown() { | 95 virtual void TearDown() { |
95 // If the GpuScheduler posts any tasks, this forces them to run. | 96 // If the GpuScheduler posts any tasks, this forces them to run. |
96 MessageLoop::current()->RunAllPending(); | 97 MessageLoop::current()->RunAllPending(); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 helper_->Finish(); | 303 helper_->Finish(); |
303 | 304 |
304 // Check that the commands did happen. | 305 // Check that the commands did happen. |
305 Mock::VerifyAndClearExpectations(api_mock_.get()); | 306 Mock::VerifyAndClearExpectations(api_mock_.get()); |
306 | 307 |
307 // Check the error status. | 308 // Check the error status. |
308 EXPECT_EQ(error::kNoError, GetError()); | 309 EXPECT_EQ(error::kNoError, GetError()); |
309 } | 310 } |
310 | 311 |
311 } // namespace gpu | 312 } // namespace gpu |
OLD | NEW |