Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_mock.h
blob0c71d48b38f0ac4c45b45cec8b88817fe7d5ddbb
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
3 // found in the LICENSE file.
5 // This file contains the mock GLES2Decoder class.
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_
10 #include <vector>
12 #include "base/callback.h"
13 #include "gpu/command_buffer/common/mailbox.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "ui/gfx/geometry/size.h"
18 namespace gfx {
19 class GLContext;
20 class GLSurface;
23 namespace gpu {
24 class AsyncPixelTransferDelegate;
26 namespace gles2 {
28 class ContextGroup;
29 class ErrorState;
30 class QueryManager;
31 struct ContextState;
33 class MockGLES2Decoder : public GLES2Decoder {
34 public:
35 MockGLES2Decoder();
36 virtual ~MockGLES2Decoder();
38 error::Error FakeDoCommands(unsigned int num_commands,
39 const void* buffer,
40 int num_entries,
41 int* entries_processed);
43 MOCK_METHOD6(Initialize,
44 bool(const scoped_refptr<gfx::GLSurface>& surface,
45 const scoped_refptr<gfx::GLContext>& context,
46 bool offscreen,
47 const gfx::Size& size,
48 const DisallowedFeatures& disallowed_features,
49 const std::vector<int32>& attribs));
50 MOCK_METHOD1(Destroy, void(bool have_context));
51 MOCK_METHOD1(SetSurface, void(const scoped_refptr<gfx::GLSurface>& surface));
52 MOCK_METHOD1(ProduceFrontBuffer, void(const Mailbox& mailbox));
53 MOCK_METHOD1(ResizeOffscreenFrameBuffer, bool(const gfx::Size& size));
54 MOCK_METHOD0(MakeCurrent, bool());
55 MOCK_METHOD1(GetServiceIdForTesting, uint32(uint32 client_id));
56 MOCK_METHOD0(GetGLES2Util, GLES2Util*());
57 MOCK_METHOD0(GetGLSurface, gfx::GLSurface*());
58 MOCK_METHOD0(GetGLContext, gfx::GLContext*());
59 MOCK_METHOD0(GetContextGroup, ContextGroup*());
60 MOCK_METHOD0(GetContextState, const ContextState*());
61 MOCK_METHOD0(GetCapabilities, Capabilities());
62 MOCK_METHOD1(ProcessPendingQueries, bool(bool));
63 MOCK_METHOD0(HasMoreIdleWork, bool());
64 MOCK_METHOD0(PerformIdleWork, void());
65 MOCK_METHOD1(RestoreState, void(const ContextState* prev_state));
66 MOCK_CONST_METHOD0(RestoreActiveTexture, void());
67 MOCK_CONST_METHOD1(
68 RestoreAllTextureUnitBindings, void(const ContextState* state));
69 MOCK_CONST_METHOD1(
70 RestoreActiveTextureUnitBinding, void(unsigned int target));
71 MOCK_CONST_METHOD0(RestoreBufferBindings, void());
72 MOCK_CONST_METHOD0(RestoreFramebufferBindings, void());
73 MOCK_CONST_METHOD0(RestoreGlobalState, void());
74 MOCK_CONST_METHOD0(RestoreProgramBindings, void());
75 MOCK_METHOD0(RestoreRenderbufferBindings, void());
76 MOCK_CONST_METHOD1(RestoreTextureState, void(unsigned service_id));
77 MOCK_CONST_METHOD1(RestoreTextureUnitBindings, void(unsigned unit));
78 MOCK_CONST_METHOD0(ClearAllAttributes, void());
79 MOCK_CONST_METHOD0(RestoreAllAttributes, void());
80 MOCK_METHOD0(GetQueryManager, gpu::gles2::QueryManager*());
81 MOCK_METHOD0(GetVertexArrayManager, gpu::gles2::VertexArrayManager*());
82 MOCK_METHOD0(GetImageManager, gpu::gles2::ImageManager*());
83 MOCK_METHOD0(GetValuebufferManager, gpu::gles2::ValuebufferManager*());
84 MOCK_METHOD1(
85 SetResizeCallback, void(const base::Callback<void(gfx::Size, float)>&));
86 MOCK_METHOD0(GetAsyncPixelTransferDelegate,
87 AsyncPixelTransferDelegate*());
88 MOCK_METHOD0(GetAsyncPixelTransferManager,
89 AsyncPixelTransferManager*());
90 MOCK_METHOD0(ResetAsyncPixelTransferManagerForTest, void());
91 MOCK_METHOD1(SetAsyncPixelTransferManagerForTest,
92 void(AsyncPixelTransferManager*));
93 MOCK_METHOD1(SetIgnoreCachedStateForTest, void(bool ignore));
94 MOCK_METHOD1(SetAllowExit, void(bool allow));
95 MOCK_METHOD3(DoCommand, error::Error(unsigned int command,
96 unsigned int arg_count,
97 const void* cmd_data));
98 MOCK_METHOD4(DoCommands,
99 error::Error(unsigned int num_commands,
100 const void* buffer,
101 int num_entries,
102 int* entries_processed));
103 MOCK_METHOD2(GetServiceTextureId, bool(uint32 client_texture_id,
104 uint32* service_texture_id));
105 MOCK_METHOD0(GetContextLostReason, error::ContextLostReason());
106 MOCK_CONST_METHOD1(GetCommandName, const char*(unsigned int command_id));
107 MOCK_METHOD9(ClearLevel,
108 bool(Texture* texture,
109 unsigned target,
110 int level,
111 unsigned format,
112 unsigned type,
113 int x_offset,
114 int y_offset,
115 int width,
116 int height));
117 MOCK_METHOD0(GetErrorState, ErrorState *());
119 MOCK_METHOD0(GetLogger, Logger*());
120 MOCK_METHOD1(SetShaderCacheCallback,
121 void(const ShaderCacheCallback& callback));
122 MOCK_METHOD1(SetWaitSyncPointCallback,
123 void(const WaitSyncPointCallback& callback));
124 MOCK_METHOD1(WaitForReadPixels,
125 void(base::Closure callback));
126 MOCK_METHOD0(GetTextureUploadCount, uint32());
127 MOCK_METHOD0(GetTotalTextureUploadTime, base::TimeDelta());
128 MOCK_METHOD0(GetTotalProcessingCommandsTime, base::TimeDelta());
129 MOCK_METHOD1(AddProcessingCommandsTime, void(base::TimeDelta));
130 MOCK_CONST_METHOD0(WasContextLost, bool());
131 MOCK_CONST_METHOD0(WasContextLostByRobustnessExtension, bool());
132 MOCK_METHOD1(MarkContextLost, void(gpu::error::ContextLostReason reason));
134 DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder);
137 } // namespace gles2
138 } // namespace gpu
140 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_