Android: Enable 'crash GPU process on context lost' WAR for Mali-400
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_mock.h
blob1e5357dae483ac512cc769dd0cb4d4250ae9ae24
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_forward.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 namespace gles2 {
26 class ContextGroup;
27 class ErrorState;
28 class QueryManager;
29 struct ContextState;
31 class MockGLES2Decoder : public GLES2Decoder {
32 public:
33 MockGLES2Decoder();
34 virtual ~MockGLES2Decoder();
36 error::Error FakeDoCommands(unsigned int num_commands,
37 const void* buffer,
38 int num_entries,
39 int* entries_processed);
41 MOCK_METHOD6(Initialize,
42 bool(const scoped_refptr<gfx::GLSurface>& surface,
43 const scoped_refptr<gfx::GLContext>& context,
44 bool offscreen,
45 const gfx::Size& size,
46 const DisallowedFeatures& disallowed_features,
47 const std::vector<int32>& attribs));
48 MOCK_METHOD1(Destroy, void(bool have_context));
49 MOCK_METHOD1(SetSurface, void(const scoped_refptr<gfx::GLSurface>& surface));
50 MOCK_METHOD1(ProduceFrontBuffer, void(const Mailbox& mailbox));
51 MOCK_METHOD1(ResizeOffscreenFrameBuffer, bool(const gfx::Size& size));
52 MOCK_METHOD0(MakeCurrent, bool());
53 MOCK_METHOD1(GetServiceIdForTesting, uint32(uint32 client_id));
54 MOCK_METHOD0(GetGLES2Util, GLES2Util*());
55 MOCK_METHOD0(GetGLSurface, gfx::GLSurface*());
56 MOCK_METHOD0(GetGLContext, gfx::GLContext*());
57 MOCK_METHOD0(GetContextGroup, ContextGroup*());
58 MOCK_METHOD0(GetContextState, const ContextState*());
59 MOCK_METHOD0(GetCapabilities, Capabilities());
60 MOCK_METHOD1(ProcessPendingQueries, bool(bool));
61 MOCK_METHOD0(HasMoreIdleWork, bool());
62 MOCK_METHOD0(PerformIdleWork, void());
63 MOCK_METHOD1(RestoreState, void(const ContextState* prev_state));
64 MOCK_CONST_METHOD0(RestoreActiveTexture, void());
65 MOCK_CONST_METHOD1(
66 RestoreAllTextureUnitBindings, void(const ContextState* state));
67 MOCK_CONST_METHOD1(
68 RestoreActiveTextureUnitBinding, void(unsigned int target));
69 MOCK_CONST_METHOD0(RestoreBufferBindings, void());
70 MOCK_CONST_METHOD0(RestoreFramebufferBindings, void());
71 MOCK_CONST_METHOD0(RestoreGlobalState, void());
72 MOCK_CONST_METHOD0(RestoreProgramBindings, void());
73 MOCK_METHOD0(RestoreRenderbufferBindings, void());
74 MOCK_CONST_METHOD1(RestoreTextureState, void(unsigned service_id));
75 MOCK_CONST_METHOD1(RestoreTextureUnitBindings, void(unsigned unit));
76 MOCK_CONST_METHOD0(ClearAllAttributes, void());
77 MOCK_CONST_METHOD0(RestoreAllAttributes, void());
78 MOCK_METHOD0(GetQueryManager, gpu::gles2::QueryManager*());
79 MOCK_METHOD0(GetVertexArrayManager, gpu::gles2::VertexArrayManager*());
80 MOCK_METHOD0(GetImageManager, gpu::gles2::ImageManager*());
81 MOCK_METHOD0(GetValuebufferManager, gpu::gles2::ValuebufferManager*());
82 MOCK_METHOD1(
83 SetResizeCallback, void(const base::Callback<void(gfx::Size, float)>&));
84 MOCK_METHOD0(GetAsyncPixelTransferDelegate,
85 AsyncPixelTransferDelegate*());
86 MOCK_METHOD0(GetAsyncPixelTransferManager,
87 AsyncPixelTransferManager*());
88 MOCK_METHOD0(ResetAsyncPixelTransferManagerForTest, void());
89 MOCK_METHOD1(SetAsyncPixelTransferManagerForTest,
90 void(AsyncPixelTransferManager*));
91 MOCK_METHOD1(SetIgnoreCachedStateForTest, void(bool ignore));
92 MOCK_METHOD1(SetAllowExit, void(bool allow));
93 MOCK_METHOD3(DoCommand, error::Error(unsigned int command,
94 unsigned int arg_count,
95 const void* cmd_data));
96 MOCK_METHOD4(DoCommands,
97 error::Error(unsigned int num_commands,
98 const void* buffer,
99 int num_entries,
100 int* entries_processed));
101 MOCK_METHOD2(GetServiceTextureId, bool(uint32 client_texture_id,
102 uint32* service_texture_id));
103 MOCK_METHOD0(GetContextLostReason, error::ContextLostReason());
104 MOCK_CONST_METHOD1(GetCommandName, const char*(unsigned int command_id));
105 MOCK_METHOD9(ClearLevel, bool(
106 Texture* texture,
107 unsigned target,
108 int level,
109 unsigned internal_format,
110 unsigned format,
111 unsigned type,
112 int width,
113 int height,
114 bool is_texture_immutable));
115 MOCK_METHOD0(GetErrorState, ErrorState *());
117 MOCK_METHOD0(GetLogger, Logger*());
118 MOCK_METHOD1(SetShaderCacheCallback,
119 void(const ShaderCacheCallback& callback));
120 MOCK_METHOD1(SetWaitSyncPointCallback,
121 void(const WaitSyncPointCallback& callback));
122 MOCK_METHOD1(WaitForReadPixels,
123 void(base::Closure callback));
124 MOCK_METHOD0(GetTextureUploadCount, uint32());
125 MOCK_METHOD0(GetTotalTextureUploadTime, base::TimeDelta());
126 MOCK_METHOD0(GetTotalProcessingCommandsTime, base::TimeDelta());
127 MOCK_METHOD1(AddProcessingCommandsTime, void(base::TimeDelta));
128 MOCK_CONST_METHOD0(WasContextLost, bool());
129 MOCK_CONST_METHOD0(WasContextLostByRobustnessExtension, bool());
130 MOCK_METHOD1(MarkContextLost, void(gpu::error::ContextLostReason reason));
132 DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder);
135 } // namespace gles2
136 } // namespace gpu
138 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_