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 // This file contains the tests for the FencedAllocator class. | 5 // This file contains the tests for the FencedAllocator class. |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/aligned_memory.h" | 9 #include "base/memory/aligned_memory.h" |
10 #include "base/message_loop/message_loop.h" | |
11 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 10 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
12 #include "gpu/command_buffer/client/fenced_allocator.h" | 11 #include "gpu/command_buffer/client/fenced_allocator.h" |
13 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 12 #include "gpu/command_buffer/service/cmd_buffer_engine.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::InvokeWithoutArgs; | 27 using testing::InvokeWithoutArgs; |
33 using testing::_; | 28 using testing::_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 api_mock_->set_engine(gpu_scheduler_.get()); | 62 api_mock_->set_engine(gpu_scheduler_.get()); |
68 | 63 |
69 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 64 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
70 helper_->Initialize(kBufferSize); | 65 helper_->Initialize(kBufferSize); |
71 } | 66 } |
72 | 67 |
73 int32 GetToken() { | 68 int32 GetToken() { |
74 return command_buffer_->GetLastState().token; | 69 return command_buffer_->GetLastState().token; |
75 } | 70 } |
76 | 71 |
77 #if defined(OS_MACOSX) | |
78 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | |
79 #endif | |
80 base::MessageLoop message_loop_; | |
81 scoped_ptr<AsyncAPIMock> api_mock_; | 72 scoped_ptr<AsyncAPIMock> api_mock_; |
82 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 73 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
83 scoped_ptr<CommandBufferService> command_buffer_; | 74 scoped_ptr<CommandBufferService> command_buffer_; |
84 scoped_ptr<GpuScheduler> gpu_scheduler_; | 75 scoped_ptr<GpuScheduler> gpu_scheduler_; |
85 scoped_ptr<CommandBufferHelper> helper_; | 76 scoped_ptr<CommandBufferHelper> helper_; |
86 }; | 77 }; |
87 | 78 |
88 #ifndef _MSC_VER | 79 #ifndef _MSC_VER |
89 const unsigned int BaseFencedAllocatorTest::kBufferSize; | 80 const unsigned int BaseFencedAllocatorTest::kBufferSize; |
90 #endif | 81 #endif |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 EXPECT_LE(token, GetToken()); | 627 EXPECT_LE(token, GetToken()); |
637 | 628 |
638 // Free up everything. | 629 // Free up everything. |
639 for (unsigned int i = 0; i < kAllocCount; ++i) { | 630 for (unsigned int i = 0; i < kAllocCount; ++i) { |
640 allocator_->Free(pointers[i]); | 631 allocator_->Free(pointers[i]); |
641 EXPECT_TRUE(allocator_->CheckConsistency()); | 632 EXPECT_TRUE(allocator_->CheckConsistency()); |
642 } | 633 } |
643 } | 634 } |
644 | 635 |
645 } // namespace gpu | 636 } // namespace gpu |
OLD | NEW |