OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ |
7 | 7 |
8 #include "../common/command_buffer.h" | 8 #include "../common/command_buffer.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class SharedMemory; | 12 class SharedMemory; |
13 } | 13 } |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 // An NPObject that implements a shared memory command buffer and a synchronous | 17 // An NPObject that implements a shared memory command buffer and a synchronous |
18 // API to manage the put and get pointers. | 18 // API to manage the put and get pointers. |
19 class MockCommandBuffer : public CommandBuffer { | 19 class MockCommandBuffer : public CommandBuffer { |
20 public: | 20 public: |
21 MockCommandBuffer(); | 21 MockCommandBuffer(); |
22 virtual ~MockCommandBuffer(); | 22 virtual ~MockCommandBuffer(); |
23 | 23 |
24 MOCK_METHOD1(Initialize, bool(int32 size)); | 24 MOCK_METHOD1(Initialize, bool(int32 size)); |
25 MOCK_METHOD2(Initialize, bool(base::SharedMemory* buffer, int32 size)); | 25 MOCK_METHOD2(Initialize, bool(base::SharedMemory* buffer, int32 size)); |
26 MOCK_METHOD0(GetRingBuffer, Buffer()); | 26 MOCK_METHOD0(GetRingBuffer, Buffer()); |
27 MOCK_METHOD0(GetState, State()); | 27 MOCK_METHOD0(GetState, State()); |
28 MOCK_METHOD0(GetLastState, State()); | |
29 MOCK_METHOD1(Flush, void(int32 put_offset)); | 28 MOCK_METHOD1(Flush, void(int32 put_offset)); |
30 MOCK_METHOD2(FlushSync, State(int32 put_offset, int32 last_known_get)); | 29 MOCK_METHOD2(FlushSync, State(int32 put_offset, int32 last_known_get)); |
31 MOCK_METHOD1(SetGetOffset, void(int32 get_offset)); | 30 MOCK_METHOD1(SetGetOffset, void(int32 get_offset)); |
32 MOCK_METHOD2(CreateTransferBuffer, int32(size_t size, int32 id_request)); | 31 MOCK_METHOD2(CreateTransferBuffer, int32(size_t size, int32 id_request)); |
33 MOCK_METHOD1(DestroyTransferBuffer, void(int32 handle)); | 32 MOCK_METHOD1(DestroyTransferBuffer, void(int32 handle)); |
34 MOCK_METHOD1(GetTransferBuffer, Buffer(int32 handle)); | 33 MOCK_METHOD1(GetTransferBuffer, Buffer(int32 handle)); |
35 MOCK_METHOD3(RegisterTransferBuffer, int32(base::SharedMemory* shared_memory, | 34 MOCK_METHOD3(RegisterTransferBuffer, int32(base::SharedMemory* shared_memory, |
36 size_t size, | 35 size_t size, |
37 int32 id_request)); | 36 int32 id_request)); |
38 MOCK_METHOD1(SetToken, void(int32 token)); | 37 MOCK_METHOD1(SetToken, void(int32 token)); |
39 MOCK_METHOD1(SetParseError, void(error::Error error)); | 38 MOCK_METHOD1(SetParseError, void(error::Error error)); |
40 MOCK_METHOD1(SetContextLostReason, | 39 MOCK_METHOD1(SetContextLostReason, |
41 void(error::ContextLostReason context_lost_reason)); | 40 void(error::ContextLostReason context_lost_reason)); |
42 | 41 |
43 private: | 42 private: |
44 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); | 43 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); |
45 }; | 44 }; |
46 | 45 |
47 } // namespace gpu | 46 } // namespace gpu |
48 | 47 |
49 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ | 48 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ |
OLD | NEW |