| 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 <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | |
| 13 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 12 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 14 #include "gpu/command_buffer/service/command_buffer_service.h" | 13 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 15 #include "gpu/command_buffer/service/gpu_scheduler.h" | 14 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 16 #include "gpu/command_buffer/service/mocks.h" | 15 #include "gpu/command_buffer/service/mocks.h" |
| 17 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 16 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 18 |
| 20 #if defined(OS_MACOSX) | |
| 21 #include "base/mac/scoped_nsautorelease_pool.h" | |
| 22 #endif | |
| 23 | |
| 24 namespace gpu { | 19 namespace gpu { |
| 25 | 20 |
| 26 using testing::Return; | 21 using testing::Return; |
| 27 using testing::Mock; | 22 using testing::Mock; |
| 28 using testing::Truly; | 23 using testing::Truly; |
| 29 using testing::Sequence; | 24 using testing::Sequence; |
| 30 using testing::DoAll; | 25 using testing::DoAll; |
| 31 using testing::Invoke; | 26 using testing::Invoke; |
| 32 using testing::_; | 27 using testing::_; |
| 33 | 28 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 int32 GetHelperPutOffset() { return helper_->put_; } | 244 int32 GetHelperPutOffset() { return helper_->put_; } |
| 250 | 245 |
| 251 uint32 GetHelperFlushGeneration() { return helper_->flush_generation(); } | 246 uint32 GetHelperFlushGeneration() { return helper_->flush_generation(); } |
| 252 | 247 |
| 253 error::Error GetError() { | 248 error::Error GetError() { |
| 254 return command_buffer_->GetLastState().error; | 249 return command_buffer_->GetLastState().error; |
| 255 } | 250 } |
| 256 | 251 |
| 257 CommandBufferOffset get_helper_put() { return helper_->put_; } | 252 CommandBufferOffset get_helper_put() { return helper_->put_; } |
| 258 | 253 |
| 259 #if defined(OS_MACOSX) | |
| 260 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | |
| 261 #endif | |
| 262 base::MessageLoop message_loop_; | |
| 263 scoped_ptr<AsyncAPIMock> api_mock_; | 254 scoped_ptr<AsyncAPIMock> api_mock_; |
| 264 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 255 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 265 scoped_ptr<CommandBufferServiceLocked> command_buffer_; | 256 scoped_ptr<CommandBufferServiceLocked> command_buffer_; |
| 266 scoped_ptr<GpuScheduler> gpu_scheduler_; | 257 scoped_ptr<GpuScheduler> gpu_scheduler_; |
| 267 scoped_ptr<CommandBufferHelper> helper_; | 258 scoped_ptr<CommandBufferHelper> helper_; |
| 268 std::list<linked_ptr<std::vector<CommandBufferEntry> > > test_command_args_; | 259 std::list<linked_ptr<std::vector<CommandBufferEntry> > > test_command_args_; |
| 269 unsigned int test_command_next_id_; | 260 unsigned int test_command_next_id_; |
| 270 Sequence sequence_; | 261 Sequence sequence_; |
| 271 }; | 262 }; |
| 272 | 263 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 helper_->OrderingBarrier(); | 754 helper_->OrderingBarrier(); |
| 764 flush_count2 = command_buffer_->FlushCount(); | 755 flush_count2 = command_buffer_->FlushCount(); |
| 765 helper_->OrderingBarrier(); | 756 helper_->OrderingBarrier(); |
| 766 flush_count3 = command_buffer_->FlushCount(); | 757 flush_count3 = command_buffer_->FlushCount(); |
| 767 | 758 |
| 768 EXPECT_EQ(flush_count2, flush_count1 + 1); | 759 EXPECT_EQ(flush_count2, flush_count1 + 1); |
| 769 EXPECT_EQ(flush_count3, flush_count2 + 1); | 760 EXPECT_EQ(flush_count3, flush_count2 + 1); |
| 770 } | 761 } |
| 771 | 762 |
| 772 } // namespace gpu | 763 } // namespace gpu |
| OLD | NEW |