| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| 11 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 11 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 13 #include "gpu/command_buffer/service/mocks.h" | 13 #include "gpu/command_buffer/service/mocks.h" |
| 14 #include "gpu/command_buffer/service/command_buffer_service.h" | 14 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 15 #include "gpu/command_buffer/service/gpu_processor.h" | 15 #include "gpu/command_buffer/service/gpu_processor.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 | 19 |
| 20 using testing::Return; | 20 using testing::Return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 api_mock_->set_engine(gpu_processor_.get()); | 60 api_mock_->set_engine(gpu_processor_.get()); |
| 61 | 61 |
| 62 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 62 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
| 63 helper_->Initialize(kBufferSize); | 63 helper_->Initialize(kBufferSize); |
| 64 } | 64 } |
| 65 | 65 |
| 66 int32 GetToken() { | 66 int32 GetToken() { |
| 67 return command_buffer_->GetState().token; | 67 return command_buffer_->GetState().token; |
| 68 } | 68 } |
| 69 | 69 |
| 70 base::ScopedNSAutoreleasePool autorelease_pool_; | 70 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 71 MessageLoop message_loop_; | 71 MessageLoop message_loop_; |
| 72 scoped_ptr<AsyncAPIMock> api_mock_; | 72 scoped_ptr<AsyncAPIMock> api_mock_; |
| 73 scoped_ptr<CommandBufferService> command_buffer_; | 73 scoped_ptr<CommandBufferService> command_buffer_; |
| 74 scoped_ptr<GPUProcessor> gpu_processor_; | 74 scoped_ptr<GPUProcessor> gpu_processor_; |
| 75 CommandParser* parser_; | 75 CommandParser* parser_; |
| 76 scoped_ptr<CommandBufferHelper> helper_; | 76 scoped_ptr<CommandBufferHelper> helper_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #ifndef _MSC_VER | 79 #ifndef _MSC_VER |
| 80 const unsigned int BaseRingBufferTest::kBaseOffset; | 80 const unsigned int BaseRingBufferTest::kBaseOffset; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void* pointer1 = allocator_->Alloc(kSize); | 252 void* pointer1 = allocator_->Alloc(kSize); |
| 253 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); | 253 EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); |
| 254 | 254 |
| 255 // Check that the token has indeed passed. | 255 // Check that the token has indeed passed. |
| 256 EXPECT_LE(tokens[0], GetToken()); | 256 EXPECT_LE(tokens[0], GetToken()); |
| 257 | 257 |
| 258 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); | 258 allocator_->FreePendingToken(pointer1, helper_->InsertToken()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace gpu | 261 } // namespace gpu |
| OLD | NEW |