OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 | 10 |
11 namespace gpu { | 11 namespace gpu { |
12 | 12 |
13 // An NPObject that implements a shared memory command buffer and a synchronous | 13 // An NPObject that implements a shared memory command buffer and a synchronous |
14 // API to manage the put and get pointers. | 14 // API to manage the put and get pointers. |
15 class MockCommandBuffer : public CommandBuffer { | 15 class MockCommandBuffer : public CommandBuffer { |
16 public: | 16 public: |
17 MockCommandBuffer() { | 17 MockCommandBuffer() { |
18 ON_CALL(*this, GetRingBuffer()) | 18 ON_CALL(*this, GetRingBuffer()) |
19 .WillByDefault(testing::Return(static_cast<base::SharedMemory*>(NULL))); | 19 .WillByDefault(testing::Return(Buffer())); |
20 ON_CALL(*this, GetTransferBuffer(testing::_)) | 20 ON_CALL(*this, GetTransferBuffer(testing::_)) |
21 .WillByDefault(testing::Return(static_cast<base::SharedMemory*>(NULL))); | 21 .WillByDefault(testing::Return(Buffer())); |
22 } | 22 } |
23 | 23 |
24 MOCK_METHOD1(Initialize, base::SharedMemory*(int32 size)); | 24 MOCK_METHOD1(Initialize, bool(int32 size)); |
25 MOCK_METHOD0(GetRingBuffer, base::SharedMemory*()); | 25 MOCK_METHOD0(GetRingBuffer, Buffer()); |
26 MOCK_METHOD0(GetSize, int32()); | 26 MOCK_METHOD0(GetSize, int32()); |
27 MOCK_METHOD1(SyncOffsets, int32(int32 put_offset)); | 27 MOCK_METHOD1(SyncOffsets, int32(int32 put_offset)); |
28 MOCK_METHOD0(GetGetOffset, int32()); | 28 MOCK_METHOD0(GetGetOffset, int32()); |
29 MOCK_METHOD1(SetGetOffset, void(int32 get_offset)); | 29 MOCK_METHOD1(SetGetOffset, void(int32 get_offset)); |
30 MOCK_METHOD0(GetPutOffset, int32()); | 30 MOCK_METHOD0(GetPutOffset, int32()); |
31 MOCK_METHOD1(SetPutOffsetChangeCallback, void(Callback0::Type* callback)); | 31 MOCK_METHOD1(SetPutOffsetChangeCallback, void(Callback0::Type* callback)); |
32 MOCK_METHOD1(CreateTransferBuffer, int32(size_t size)); | 32 MOCK_METHOD1(CreateTransferBuffer, int32(size_t size)); |
33 MOCK_METHOD1(DestroyTransferBuffer, void(int32 handle)); | 33 MOCK_METHOD1(DestroyTransferBuffer, void(int32 handle)); |
34 MOCK_METHOD1(GetTransferBuffer, base::SharedMemory*(int32 handle)); | 34 MOCK_METHOD1(GetTransferBuffer, Buffer(int32 handle)); |
35 MOCK_METHOD0(GetToken, int32()); | 35 MOCK_METHOD0(GetToken, int32()); |
36 MOCK_METHOD1(SetToken, void(int32 token)); | 36 MOCK_METHOD1(SetToken, void(int32 token)); |
37 MOCK_METHOD0(ResetParseError, int32()); | 37 MOCK_METHOD0(ResetParseError, int32()); |
38 MOCK_METHOD1(SetParseError, void(int32 parse_erro)); | 38 MOCK_METHOD1(SetParseError, void(int32 parse_erro)); |
39 MOCK_METHOD0(GetErrorStatus, bool()); | 39 MOCK_METHOD0(GetErrorStatus, bool()); |
40 MOCK_METHOD0(RaiseErrorStatus, void()); | 40 MOCK_METHOD0(RaiseErrorStatus, void()); |
41 | 41 |
42 private: | 42 private: |
43 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); | 43 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); |
44 }; | 44 }; |
45 | 45 |
46 } // namespace gpu | 46 } // namespace gpu |
47 | 47 |
48 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ | 48 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ |
OLD | NEW |