| 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" | |
| 9 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 9 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 11 #include "gpu/command_buffer/service/mocks.h" | 10 #include "gpu/command_buffer/service/mocks.h" |
| 12 #include "gpu/command_buffer/service/command_buffer_service.h" | 11 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 13 #include "gpu/command_buffer/service/gpu_scheduler.h" | 12 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 14 |
| 15 #if defined(OS_MACOSX) |
| 16 #include "base/mac/scoped_nsautorelease_pool.h" |
| 17 #endif |
| 18 |
| 16 namespace gpu { | 19 namespace gpu { |
| 17 | 20 |
| 18 using testing::Return; | 21 using testing::Return; |
| 19 using testing::Mock; | 22 using testing::Mock; |
| 20 using testing::Truly; | 23 using testing::Truly; |
| 21 using testing::Sequence; | 24 using testing::Sequence; |
| 22 using testing::DoAll; | 25 using testing::DoAll; |
| 23 using testing::Invoke; | 26 using testing::Invoke; |
| 24 using testing::_; | 27 using testing::_; |
| 25 | 28 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 int32 GetPutOffset() { | 148 int32 GetPutOffset() { |
| 146 return command_buffer_->GetState().put_offset; | 149 return command_buffer_->GetState().put_offset; |
| 147 } | 150 } |
| 148 | 151 |
| 149 error::Error GetError() { | 152 error::Error GetError() { |
| 150 return command_buffer_->GetState().error; | 153 return command_buffer_->GetState().error; |
| 151 } | 154 } |
| 152 | 155 |
| 153 CommandBufferOffset get_helper_put() { return helper_->put_; } | 156 CommandBufferOffset get_helper_put() { return helper_->put_; } |
| 154 | 157 |
| 158 #if defined(OS_MACOSX) |
| 155 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 159 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 160 #endif |
| 156 MessageLoop message_loop_; | 161 MessageLoop message_loop_; |
| 157 scoped_ptr<AsyncAPIMock> api_mock_; | 162 scoped_ptr<AsyncAPIMock> api_mock_; |
| 158 scoped_ptr<CommandBufferService> command_buffer_; | 163 scoped_ptr<CommandBufferService> command_buffer_; |
| 159 scoped_ptr<GpuScheduler> gpu_scheduler_; | 164 scoped_ptr<GpuScheduler> gpu_scheduler_; |
| 160 CommandParser* parser_; | 165 CommandParser* parser_; |
| 161 scoped_ptr<CommandBufferHelper> helper_; | 166 scoped_ptr<CommandBufferHelper> helper_; |
| 162 Sequence sequence_; | 167 Sequence sequence_; |
| 163 scoped_ptr<DoJumpCommand> do_jump_command_; | 168 scoped_ptr<DoJumpCommand> do_jump_command_; |
| 164 }; | 169 }; |
| 165 | 170 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 helper_->Finish(); | 302 helper_->Finish(); |
| 298 | 303 |
| 299 // Check that the commands did happen. | 304 // Check that the commands did happen. |
| 300 Mock::VerifyAndClearExpectations(api_mock_.get()); | 305 Mock::VerifyAndClearExpectations(api_mock_.get()); |
| 301 | 306 |
| 302 // Check the error status. | 307 // Check the error status. |
| 303 EXPECT_EQ(error::kNoError, GetError()); | 308 EXPECT_EQ(error::kNoError, GetError()); |
| 304 } | 309 } |
| 305 | 310 |
| 306 } // namespace gpu | 311 } // namespace gpu |
| OLD | NEW |