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