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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_
8 #include "gpu/command_buffer/service/command_buffer_service.h"
9 #include "testing/gmock/include/gmock/gmock.h"
17 // An NPObject that implements a shared memory command buffer and a synchronous
18 // API to manage the put and get pointers.
19 class MockCommandBuffer
: public CommandBufferServiceBase
{
22 virtual ~MockCommandBuffer();
24 MOCK_METHOD0(Initialize
, bool());
25 MOCK_METHOD0(GetLastState
, State());
26 MOCK_METHOD0(GetLastToken
, int32());
27 MOCK_METHOD1(Flush
, void(int32 put_offset
));
28 MOCK_METHOD1(OrderingBarrier
, void(int32 put_offset
));
29 MOCK_METHOD2(WaitForTokenInRange
, void(int32 start
, int32 end
));
30 MOCK_METHOD2(WaitForGetOffsetInRange
, void(int32 start
, int32 end
));
31 MOCK_METHOD1(SetGetBuffer
, void(int32 transfer_buffer_id
));
32 MOCK_METHOD1(SetGetOffset
, void(int32 get_offset
));
33 MOCK_METHOD2(CreateTransferBuffer
,
34 scoped_refptr
<gpu::Buffer
>(size_t size
, int32
* id
));
35 MOCK_METHOD1(DestroyTransferBuffer
, void(int32 id
));
36 MOCK_METHOD1(GetTransferBuffer
, scoped_refptr
<gpu::Buffer
>(int32 id
));
37 MOCK_METHOD1(SetToken
, void(int32 token
));
38 MOCK_METHOD1(SetParseError
, void(error::Error error
));
39 MOCK_METHOD1(SetContextLostReason
,
40 void(error::ContextLostReason context_lost_reason
));
41 MOCK_METHOD0(InsertSyncPoint
, uint32());
42 MOCK_METHOD0(GetPutOffset
, int32());
45 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer
);
50 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_