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. 4 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ 7 8 #include "gpu/command_buffer/service/command_buffer_service.h" 9 #include "testing/gmock/include/gmock/gmock.h" 10 11 namespace base { 12 class SharedMemory; 13 } 14 15 namespace gpu { 16 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 { 20 public: 21 MockCommandBuffer(); 22 virtual ~MockCommandBuffer(); 23 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_METHOD2(WaitForTokenInRange, void(int32 start, int32 end)); 29 MOCK_METHOD2(WaitForGetOffsetInRange, void(int32 start, int32 end)); 30 MOCK_METHOD1(SetGetBuffer, void(int32 transfer_buffer_id)); 31 MOCK_METHOD1(SetGetOffset, void(int32 get_offset)); 32 MOCK_METHOD2(CreateTransferBuffer, 33 scoped_refptr<gpu::Buffer>(size_t size, int32* id)); 34 MOCK_METHOD1(DestroyTransferBuffer, void(int32 id)); 35 MOCK_METHOD1(GetTransferBuffer, scoped_refptr<gpu::Buffer>(int32 id)); 36 MOCK_METHOD1(SetToken, void(int32 token)); 37 MOCK_METHOD1(SetParseError, void(error::Error error)); 38 MOCK_METHOD1(SetContextLostReason, 39 void(error::ContextLostReason context_lost_reason)); 40 MOCK_METHOD0(InsertSyncPoint, uint32()); 41 42 private: 43 DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer); 44 }; 45 46 } // namespace gpu 47 48 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_ 49