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 // This file contains the tests for the FencedAllocator class. | 5 // This file contains the tests for the FencedAllocator class. |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/mac/scoped_nsautorelease_pool.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/client/fenced_allocator.h" | 10 #include "gpu/command_buffer/client/fenced_allocator.h" |
12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
13 #include "gpu/command_buffer/service/mocks.h" | 12 #include "gpu/command_buffer/service/mocks.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 "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
| 17 #if defined(OS_MACOSX) |
| 18 #include "base/mac/scoped_nsautorelease_pool.h" |
| 19 #endif |
| 20 |
18 namespace gpu { | 21 namespace gpu { |
19 | 22 |
20 using testing::Return; | 23 using testing::Return; |
21 using testing::Mock; | 24 using testing::Mock; |
22 using testing::Truly; | 25 using testing::Truly; |
23 using testing::Sequence; | 26 using testing::Sequence; |
24 using testing::DoAll; | 27 using testing::DoAll; |
25 using testing::Invoke; | 28 using testing::Invoke; |
26 using testing::_; | 29 using testing::_; |
27 | 30 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 api_mock_->set_engine(gpu_scheduler_.get()); | 62 api_mock_->set_engine(gpu_scheduler_.get()); |
60 | 63 |
61 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 64 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
62 helper_->Initialize(kBufferSize); | 65 helper_->Initialize(kBufferSize); |
63 } | 66 } |
64 | 67 |
65 int32 GetToken() { | 68 int32 GetToken() { |
66 return command_buffer_->GetState().token; | 69 return command_buffer_->GetState().token; |
67 } | 70 } |
68 | 71 |
| 72 #if defined(OS_MACOSX) |
69 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 73 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 74 #endif |
70 MessageLoop message_loop_; | 75 MessageLoop message_loop_; |
71 scoped_ptr<AsyncAPIMock> api_mock_; | 76 scoped_ptr<AsyncAPIMock> api_mock_; |
72 scoped_ptr<CommandBufferService> command_buffer_; | 77 scoped_ptr<CommandBufferService> command_buffer_; |
73 scoped_ptr<GpuScheduler> gpu_scheduler_; | 78 scoped_ptr<GpuScheduler> gpu_scheduler_; |
74 CommandParser* parser_; | 79 CommandParser* parser_; |
75 scoped_ptr<CommandBufferHelper> helper_; | 80 scoped_ptr<CommandBufferHelper> helper_; |
76 }; | 81 }; |
77 | 82 |
78 #ifndef _MSC_VER | 83 #ifndef _MSC_VER |
79 const unsigned int BaseFencedAllocatorTest::kBufferSize; | 84 const unsigned int BaseFencedAllocatorTest::kBufferSize; |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 EXPECT_LE(token, GetToken()); | 524 EXPECT_LE(token, GetToken()); |
520 | 525 |
521 // Free up everything. | 526 // Free up everything. |
522 for (unsigned int i = 0; i < kAllocCount; ++i) { | 527 for (unsigned int i = 0; i < kAllocCount; ++i) { |
523 allocator_->Free(pointers[i]); | 528 allocator_->Free(pointers[i]); |
524 EXPECT_TRUE(allocator_->CheckConsistency()); | 529 EXPECT_TRUE(allocator_->CheckConsistency()); |
525 } | 530 } |
526 } | 531 } |
527 | 532 |
528 } // namespace gpu | 533 } // namespace gpu |
OLD | NEW |