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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 void WaitForTokenInRange(int32 start, int32 end) override; | 34 void WaitForTokenInRange(int32 start, int32 end) override; |
35 void WaitForGetOffsetInRange(int32 start, int32 end) override; | 35 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
36 void SetGetBuffer(int transfer_buffer_id) override; | 36 void SetGetBuffer(int transfer_buffer_id) override; |
37 void SetGetOffset(int32 get_offset) override; | 37 void SetGetOffset(int32 get_offset) override; |
38 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 scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) override; | 40 scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) override; |
41 void SetToken(int32 token) override; | 41 void SetToken(int32 token) override; |
42 void SetParseError(error::Error error) override; | 42 void SetParseError(error::Error error) override; |
43 void SetContextLostReason(error::ContextLostReason reason) override; | 43 void SetContextLostReason(error::ContextLostReason reason) override; |
| 44 int32 GetPutOffset() override; |
44 | 45 |
45 // Get's the Id of the next transfer buffer that will be returned | 46 // Get's the Id of the next transfer buffer that will be returned |
46 // by CreateTransferBuffer. This is useful for testing expected ids. | 47 // by CreateTransferBuffer. This is useful for testing expected ids. |
47 int32 GetNextFreeTransferBufferId(); | 48 int32 GetNextFreeTransferBufferId(); |
48 | 49 |
49 void FlushHelper(int32 put_offset); | 50 void FlushHelper(int32 put_offset); |
50 void DestroyTransferBufferHelper(int32 id); | 51 void DestroyTransferBufferHelper(int32 id); |
51 | 52 |
52 virtual void OnFlush() = 0; | 53 virtual void OnFlush() = 0; |
53 | 54 |
54 private: | 55 private: |
55 scoped_refptr<Buffer> transfer_buffer_buffers_[kMaxTransferBuffers]; | 56 scoped_refptr<Buffer> transfer_buffer_buffers_[kMaxTransferBuffers]; |
56 CommandBufferEntry* ring_buffer_; | 57 CommandBufferEntry* ring_buffer_; |
57 scoped_refptr<Buffer> ring_buffer_buffer_; | 58 scoped_refptr<Buffer> ring_buffer_buffer_; |
58 State state_; | 59 State state_; |
| 60 int32 put_offset_; |
59 }; | 61 }; |
60 | 62 |
61 class MockClientCommandBuffer : public MockCommandBufferBase { | 63 class MockClientCommandBuffer : public MockCommandBufferBase { |
62 public: | 64 public: |
63 MockClientCommandBuffer(); | 65 MockClientCommandBuffer(); |
64 virtual ~MockClientCommandBuffer(); | 66 virtual ~MockClientCommandBuffer(); |
65 | 67 |
66 // This is so we can use all the gmock functions when Flush is called. | 68 // This is so we can use all the gmock functions when Flush is called. |
67 MOCK_METHOD0(OnFlush, void()); | 69 MOCK_METHOD0(OnFlush, void()); |
68 MOCK_METHOD1(DestroyTransferBuffer, void(int32 id)); | 70 MOCK_METHOD1(DestroyTransferBuffer, void(int32 id)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); | 110 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); |
109 | 111 |
110 private: | 112 private: |
111 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); | 113 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); |
112 }; | 114 }; |
113 | 115 |
114 } // namespace gpu | 116 } // namespace gpu |
115 | 117 |
116 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ | 118 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ |
117 | 119 |
OLD | NEW |