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 29 matching lines...) Expand all Loading... |
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 int32 GetPutOffset() override; |
45 | 45 |
46 // 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 |
47 // by CreateTransferBuffer. This is useful for testing expected ids. | 47 // by CreateTransferBuffer. This is useful for testing expected ids. |
48 int32 GetNextFreeTransferBufferId(); | 48 int32 GetNextFreeTransferBufferId(); |
49 | 49 |
50 void FlushHelper(int32 put_offset); | 50 void FlushHelper(int32 put_offset, const std::vector<uint32>& sync_points); |
51 void DestroyTransferBufferHelper(int32 id); | 51 void DestroyTransferBufferHelper(int32 id); |
52 | 52 |
53 virtual void OnFlush() = 0; | 53 virtual void OnFlush() = 0; |
54 | 54 |
55 private: | 55 private: |
56 scoped_refptr<Buffer> transfer_buffer_buffers_[kMaxTransferBuffers]; | 56 scoped_refptr<Buffer> transfer_buffer_buffers_[kMaxTransferBuffers]; |
57 CommandBufferEntry* ring_buffer_; | 57 CommandBufferEntry* ring_buffer_; |
58 scoped_refptr<Buffer> ring_buffer_buffer_; | 58 scoped_refptr<Buffer> ring_buffer_buffer_; |
59 State state_; | 59 State state_; |
60 int32 put_offset_; | 60 int32 put_offset_; |
61 }; | 61 }; |
62 | 62 |
63 class MockClientCommandBuffer : public MockCommandBufferBase { | 63 class MockClientCommandBuffer : public MockCommandBufferBase { |
64 public: | 64 public: |
65 MockClientCommandBuffer(); | 65 MockClientCommandBuffer(); |
66 virtual ~MockClientCommandBuffer(); | 66 virtual ~MockClientCommandBuffer(); |
67 | 67 |
68 // 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. |
69 MOCK_METHOD0(OnFlush, void()); | 69 MOCK_METHOD0(OnFlush, void()); |
70 MOCK_METHOD1(DestroyTransferBuffer, void(int32 id)); | 70 MOCK_METHOD1(DestroyTransferBuffer, void(int32 id)); |
71 | 71 |
72 virtual void Flush(int32 put_offset) override; | 72 virtual void Flush(int32 put_offset, |
| 73 const std::vector<uint32>& sync_points) override; |
73 | 74 |
74 void DelegateToFake(); | 75 void DelegateToFake(); |
75 }; | 76 }; |
76 | 77 |
77 class MockClientCommandBufferMockFlush : public MockClientCommandBuffer { | 78 class MockClientCommandBufferMockFlush : public MockClientCommandBuffer { |
78 public: | 79 public: |
79 MockClientCommandBufferMockFlush(); | 80 MockClientCommandBufferMockFlush(); |
80 virtual ~MockClientCommandBufferMockFlush(); | 81 virtual ~MockClientCommandBufferMockFlush(); |
81 | 82 |
82 MOCK_METHOD1(Flush, void(int32 put_offset)); | 83 MOCK_METHOD2(Flush, |
| 84 void(int32 put_offset, const std::vector<uint32>& sync_points)); |
83 | 85 |
84 void DelegateToFake(); | 86 void DelegateToFake(); |
85 }; | 87 }; |
86 | 88 |
87 class MockClientGpuControl : public GpuControl { | 89 class MockClientGpuControl : public GpuControl { |
88 public: | 90 public: |
89 MockClientGpuControl(); | 91 MockClientGpuControl(); |
90 virtual ~MockClientGpuControl(); | 92 virtual ~MockClientGpuControl(); |
91 | 93 |
92 MOCK_METHOD0(GetCapabilities, Capabilities()); | 94 MOCK_METHOD0(GetCapabilities, Capabilities()); |
(...skipping 17 matching lines...) Expand all Loading... |
110 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); | 112 MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); |
111 | 113 |
112 private: | 114 private: |
113 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); | 115 DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); |
114 }; | 116 }; |
115 | 117 |
116 } // namespace gpu | 118 } // namespace gpu |
117 | 119 |
118 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ | 120 #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_TEST_HELPER_H_ |
119 | 121 |
OLD | NEW |