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 RingBuffer class. | 5 // This file contains the tests for the RingBuffer class. |
6 | 6 |
7 #include "gpu/command_buffer/client/ring_buffer.h" | 7 #include "gpu/command_buffer/client/ring_buffer.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/mac/scoped_nsautorelease_pool.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/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); | 86 Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand)); |
84 | 87 |
85 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 88 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
86 helper_->Initialize(kBufferSize); | 89 helper_->Initialize(kBufferSize); |
87 } | 90 } |
88 | 91 |
89 int32 GetToken() { | 92 int32 GetToken() { |
90 return command_buffer_->GetState().token; | 93 return command_buffer_->GetState().token; |
91 } | 94 } |
92 | 95 |
| 96 #if defined(OS_MACOSX) |
93 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 97 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 98 #endif |
94 MessageLoop message_loop_; | 99 MessageLoop message_loop_; |
95 scoped_ptr<AsyncAPIMock> api_mock_; | 100 scoped_ptr<AsyncAPIMock> api_mock_; |
96 scoped_ptr<CommandBufferService> command_buffer_; | 101 scoped_ptr<CommandBufferService> command_buffer_; |
97 scoped_ptr<GpuScheduler> gpu_scheduler_; | 102 scoped_ptr<GpuScheduler> gpu_scheduler_; |
98 CommandParser* parser_; | 103 CommandParser* parser_; |
99 scoped_ptr<CommandBufferHelper> helper_; | 104 scoped_ptr<CommandBufferHelper> helper_; |
100 scoped_ptr<DoJumpCommand> do_jump_command_; | 105 scoped_ptr<DoJumpCommand> do_jump_command_; |
101 }; | 106 }; |
102 | 107 |
103 #ifndef _MSC_VER | 108 #ifndef _MSC_VER |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); | 282 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); |
278 | 283 |
279 // Check that the token has indeed passed. | 284 // Check that the token has indeed passed. |
280 EXPECT_LE(tokens[0], GetToken()); | 285 EXPECT_LE(tokens[0], GetToken()); |
281 | 286 |
282 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); | 287 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); |
283 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); | 288 EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); |
284 } | 289 } |
285 | 290 |
286 } // namespace gpu | 291 } // namespace gpu |
OLD | NEW |