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 // Helper classes for implementing gpu client side unit tests. | 5 // Helper classes for implementing gpu client side unit tests. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ |
8 #define GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "gpu/command_buffer/client/gpu_control.h" | 12 #include "gpu/command_buffer/client/gpu_control.h" |
13 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 13 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
14 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 14 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
15 #include "gpu/command_buffer/service/command_buffer_service.h" | 15 #include "gpu/command_buffer/service/command_buffer_service.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace gpu { | 19 namespace gpu { |
20 | 20 |
21 class CommandBufferHelper; | 21 class CommandBufferHelper; |
22 | 22 |
23 class MockCommandBufferBase : public CommandBufferServiceBase { | 23 class MockCommandBufferBase : public CommandBufferServiceBase { |
24 public: | 24 public: |
25 static const int32 kTransferBufferBaseId = 0x123; | 25 static const int32 kTransferBufferBaseId = 0x123; |
26 static const int32 kMaxTransferBuffers = 6; | 26 static const int32 kMaxTransferBuffers = 6; |
27 | 27 |
28 MockCommandBufferBase(); | 28 MockCommandBufferBase(); |
29 virtual ~MockCommandBufferBase(); | 29 ~MockCommandBufferBase() override; |
30 | 30 |
31 virtual bool Initialize() override; | 31 bool Initialize() override; |
32 virtual State GetLastState() override; | 32 State GetLastState() override; |
33 virtual int32 GetLastToken() override; | 33 int32 GetLastToken() override; |
34 virtual void WaitForTokenInRange(int32 start, int32 end) override; | 34 void WaitForTokenInRange(int32 start, int32 end) override; |
35 virtual void WaitForGetOffsetInRange(int32 start, int32 end) override; | 35 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
36 virtual void SetGetBuffer(int transfer_buffer_id) override; | 36 void SetGetBuffer(int transfer_buffer_id) override; |
37 virtual void SetGetOffset(int32 get_offset) override; | 37 void SetGetOffset(int32 get_offset) override; |
38 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 38 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
39 int32* id) override; | 39 int32* id) override; |
40 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) override; | 40 scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) override; |
41 virtual void SetToken(int32 token) override; | 41 void SetToken(int32 token) override; |
42 virtual void SetParseError(error::Error error) override; | 42 void SetParseError(error::Error error) override; |
43 virtual void SetContextLostReason(error::ContextLostReason reason) override; | 43 void SetContextLostReason(error::ContextLostReason reason) override; |
44 | 44 |
45 // Get's the Id of the next transfer buffer that will be returned | 45 // Get's the Id of the next transfer buffer that will be returned |
46 // by CreateTransferBuffer. This is useful for testing expected ids. | 46 // by CreateTransferBuffer. This is useful for testing expected ids. |
47 int32 GetNextFreeTransferBufferId(); | 47 int32 GetNextFreeTransferBufferId(); |
48 | 48 |
49 void FlushHelper(int32 put_offset); | 49 void FlushHelper(int32 put_offset); |
50 void DestroyTransferBufferHelper(int32 id); | 50 void DestroyTransferBufferHelper(int32 id); |
51 | 51 |
52 virtual void OnFlush() = 0; | 52 virtual void OnFlush() = 0; |
53 | 53 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); | 108 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); |
109 | 109 |
110 private: | 110 private: |
111 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); | 111 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); |
112 }; | 112 }; |
113 | 113 |
114 } // namespace gpu | 114 } // namespace gpu |
115 | 115 |
116 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ | 116 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ |
117 | 117 |
OLD | NEW |