| 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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 16 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 17 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 17 #include "gpu/command_buffer/service/command_buffer_service.h" | 18 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 18 #include "gpu/command_buffer/service/command_executor.h" | 19 #include "gpu/command_buffer/service/command_executor.h" |
| 19 #include "gpu/command_buffer/service/mocks.h" | 20 #include "gpu/command_buffer/service/mocks.h" |
| 20 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 21 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 int32_t GetHelperPutOffset() { return helper_->put_; } | 252 int32_t GetHelperPutOffset() { return helper_->put_; } |
| 252 | 253 |
| 253 uint32_t GetHelperFlushGeneration() { return helper_->flush_generation(); } | 254 uint32_t GetHelperFlushGeneration() { return helper_->flush_generation(); } |
| 254 | 255 |
| 255 error::Error GetError() { | 256 error::Error GetError() { |
| 256 return command_buffer_->GetLastState().error; | 257 return command_buffer_->GetLastState().error; |
| 257 } | 258 } |
| 258 | 259 |
| 259 CommandBufferOffset get_helper_put() { return helper_->put_; } | 260 CommandBufferOffset get_helper_put() { return helper_->put_; } |
| 260 | 261 |
| 261 scoped_ptr<AsyncAPIMock> api_mock_; | 262 std::unique_ptr<AsyncAPIMock> api_mock_; |
| 262 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 263 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 263 scoped_ptr<CommandBufferServiceLocked> command_buffer_; | 264 std::unique_ptr<CommandBufferServiceLocked> command_buffer_; |
| 264 scoped_ptr<CommandExecutor> executor_; | 265 std::unique_ptr<CommandExecutor> executor_; |
| 265 scoped_ptr<CommandBufferHelper> helper_; | 266 std::unique_ptr<CommandBufferHelper> helper_; |
| 266 std::list<linked_ptr<std::vector<CommandBufferEntry> > > test_command_args_; | 267 std::list<linked_ptr<std::vector<CommandBufferEntry> > > test_command_args_; |
| 267 unsigned int test_command_next_id_; | 268 unsigned int test_command_next_id_; |
| 268 Sequence sequence_; | 269 Sequence sequence_; |
| 269 base::MessageLoop message_loop_; | 270 base::MessageLoop message_loop_; |
| 270 }; | 271 }; |
| 271 | 272 |
| 272 // Checks immediate_entry_count_ changes based on 'usable' state. | 273 // Checks immediate_entry_count_ changes based on 'usable' state. |
| 273 TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesNotUsable) { | 274 TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesNotUsable) { |
| 274 // Auto flushing mode is tested separately. | 275 // Auto flushing mode is tested separately. |
| 275 helper_->SetAutomaticFlushes(false); | 276 helper_->SetAutomaticFlushes(false); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 helper_->OrderingBarrier(); | 763 helper_->OrderingBarrier(); |
| 763 flush_count2 = command_buffer_->FlushCount(); | 764 flush_count2 = command_buffer_->FlushCount(); |
| 764 helper_->OrderingBarrier(); | 765 helper_->OrderingBarrier(); |
| 765 flush_count3 = command_buffer_->FlushCount(); | 766 flush_count3 = command_buffer_->FlushCount(); |
| 766 | 767 |
| 767 EXPECT_EQ(flush_count2, flush_count1 + 1); | 768 EXPECT_EQ(flush_count2, flush_count1 + 1); |
| 768 EXPECT_EQ(flush_count3, flush_count2 + 1); | 769 EXPECT_EQ(flush_count3, flush_count2 + 1); |
| 769 } | 770 } |
| 770 | 771 |
| 771 } // namespace gpu | 772 } // namespace gpu |
| OLD | NEW |