| OLD | NEW |
| 1 // Copyright (c) 2009 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 #include "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/scoped_nsautorelease_pool.h" | 6 #include "base/mac/scoped_nsautorelease_pool.h" |
| 7 #include "base/thread.h" | 7 #include "base/thread.h" |
| 8 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 8 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
| 9 #include "gpu/command_buffer/service/command_buffer_service.h" | 9 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 | 12 |
| 13 using base::SharedMemory; | 13 using base::SharedMemory; |
| 14 using testing::_; | 14 using testing::_; |
| 15 using testing::DoAll; | 15 using testing::DoAll; |
| 16 using testing::Return; | 16 using testing::Return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 int32 GetToken() { | 36 int32 GetToken() { |
| 37 return command_buffer_->GetState().token; | 37 return command_buffer_->GetState().token; |
| 38 } | 38 } |
| 39 | 39 |
| 40 int32 GetError() { | 40 int32 GetError() { |
| 41 return command_buffer_->GetState().error; | 41 return command_buffer_->GetState().error; |
| 42 } | 42 } |
| 43 | 43 |
| 44 base::ScopedNSAutoreleasePool autorelease_pool_; | 44 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 45 scoped_ptr<CommandBufferService> command_buffer_; | 45 scoped_ptr<CommandBufferService> command_buffer_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 TEST_F(CommandBufferServiceTest, NullRingBufferByDefault) { | 48 TEST_F(CommandBufferServiceTest, NullRingBufferByDefault) { |
| 49 EXPECT_TRUE(NULL == command_buffer_->GetRingBuffer().ptr); | 49 EXPECT_TRUE(NULL == command_buffer_->GetRingBuffer().ptr); |
| 50 } | 50 } |
| 51 | 51 |
| 52 TEST_F(CommandBufferServiceTest, InitializesCommandBuffer) { | 52 TEST_F(CommandBufferServiceTest, InitializesCommandBuffer) { |
| 53 EXPECT_TRUE(command_buffer_->Initialize(1024)); | 53 EXPECT_TRUE(command_buffer_->Initialize(1024)); |
| 54 EXPECT_TRUE(NULL != command_buffer_->GetRingBuffer().ptr); | 54 EXPECT_TRUE(NULL != command_buffer_->GetRingBuffer().ptr); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 TEST_F(CommandBufferServiceTest, DefaultParseErrorIsNoError) { | 194 TEST_F(CommandBufferServiceTest, DefaultParseErrorIsNoError) { |
| 195 EXPECT_EQ(0, GetError()); | 195 EXPECT_EQ(0, GetError()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 TEST_F(CommandBufferServiceTest, CanSetParseError) { | 198 TEST_F(CommandBufferServiceTest, CanSetParseError) { |
| 199 command_buffer_->SetParseError(error::kInvalidSize); | 199 command_buffer_->SetParseError(error::kInvalidSize); |
| 200 EXPECT_EQ(1, GetError()); | 200 EXPECT_EQ(1, GetError()); |
| 201 } | 201 } |
| 202 } // namespace gpu | 202 } // namespace gpu |
| OLD | NEW |