Home | History | Annotate | Download | only in service
      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.
      4 
      5 // This file contains the mock GLES2Decoder class.
      6 
      7 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_
      8 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_
      9 
     10 #include <vector>
     11 
     12 #include "gpu/command_buffer/common/mailbox.h"
     13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
     14 #include "base/callback_forward.h"
     15 #include "testing/gmock/include/gmock/gmock.h"
     16 #include "ui/gfx/size.h"
     17 
     18 namespace gfx {
     19 class GLContext;
     20 class GLSurface;
     21 }
     22 
     23 namespace gpu {
     24 class StreamTextureManager;
     25 
     26 namespace gles2 {
     27 
     28 class ContextGroup;
     29 class ErrorState;
     30 class QueryManager;
     31 
     32 class MockGLES2Decoder : public GLES2Decoder {
     33  public:
     34   MockGLES2Decoder();
     35   virtual ~MockGLES2Decoder();
     36 
     37   MOCK_METHOD7(Initialize,
     38                bool(const scoped_refptr<gfx::GLSurface>& surface,
     39                     const scoped_refptr<gfx::GLContext>& context,
     40                     bool offscreen,
     41                     const gfx::Size& size,
     42                     const DisallowedFeatures& disallowed_features,
     43                     const char* allowed_extensions,
     44                     const std::vector<int32>& attribs));
     45   MOCK_METHOD1(Destroy, void(bool have_context));
     46   MOCK_METHOD1(SetSurface, void(const scoped_refptr<gfx::GLSurface>& surface));
     47   MOCK_METHOD1(ProduceFrontBuffer, bool(const Mailbox& mailbox));
     48   MOCK_METHOD1(ResizeOffscreenFrameBuffer, bool(const gfx::Size& size));
     49   MOCK_METHOD0(MakeCurrent, bool());
     50   MOCK_METHOD0(ReleaseCurrent, void());
     51   MOCK_METHOD1(GetServiceIdForTesting, uint32(uint32 client_id));
     52   MOCK_METHOD0(GetGLES2Util, GLES2Util*());
     53   MOCK_METHOD0(GetGLSurface, gfx::GLSurface*());
     54   MOCK_METHOD0(GetGLContext, gfx::GLContext*());
     55   MOCK_METHOD0(GetContextGroup, ContextGroup*());
     56   MOCK_METHOD0(ProcessPendingQueries, bool());
     57   MOCK_METHOD0(HasMoreIdleWork, bool());
     58   MOCK_METHOD0(PerformIdleWork, void());
     59   MOCK_CONST_METHOD0(RestoreState, void());
     60   MOCK_CONST_METHOD0(RestoreActiveTexture, void());
     61   MOCK_CONST_METHOD0(RestoreAllTextureUnitBindings, void());
     62   MOCK_CONST_METHOD1(RestoreAttribute, void(unsigned index));
     63   MOCK_CONST_METHOD0(RestoreBufferBindings, void());
     64   MOCK_CONST_METHOD0(RestoreFramebufferBindings, void());
     65   MOCK_CONST_METHOD0(RestoreGlobalState, void());
     66   MOCK_CONST_METHOD0(RestoreProgramBindings, void());
     67   MOCK_CONST_METHOD0(RestoreRenderbufferBindings, void());
     68   MOCK_CONST_METHOD1(RestoreTextureState, void(unsigned service_id));
     69   MOCK_CONST_METHOD1(RestoreTextureUnitBindings, void(unsigned unit));
     70   MOCK_METHOD0(GetQueryManager, gpu::gles2::QueryManager*());
     71   MOCK_METHOD0(GetVertexArrayManager, gpu::gles2::VertexArrayManager*());
     72   MOCK_METHOD1(
     73       SetResizeCallback, void(const base::Callback<void(gfx::Size, float)>&));
     74   MOCK_METHOD0(GetAsyncPixelTransferDelegate,
     75       AsyncPixelTransferDelegate*());
     76   MOCK_METHOD0(GetAsyncPixelTransferManager,
     77       AsyncPixelTransferManager*());
     78   MOCK_METHOD0(ResetAsyncPixelTransferManagerForTest, void());
     79   MOCK_METHOD1(SetAsyncPixelTransferManagerForTest,
     80       void(AsyncPixelTransferManager*));
     81   MOCK_METHOD3(DoCommand, error::Error(unsigned int command,
     82                                        unsigned int arg_count,
     83                                        const void* cmd_data));
     84   MOCK_METHOD2(GetServiceTextureId, bool(uint32 client_texture_id,
     85                                          uint32* service_texture_id));
     86   MOCK_METHOD0(GetContextLostReason, error::ContextLostReason());
     87   MOCK_CONST_METHOD1(GetCommandName, const char*(unsigned int command_id));
     88   MOCK_METHOD9(ClearLevel, bool(
     89       unsigned service_id,
     90       unsigned bind_target,
     91       unsigned target,
     92       int level,
     93       unsigned format,
     94       unsigned type,
     95       int width,
     96       int height,
     97       bool is_texture_immutable));
     98   MOCK_METHOD0(GetErrorState, ErrorState *());
     99 
    100   MOCK_METHOD0(GetLogger, Logger*());
    101   MOCK_METHOD1(SetShaderCacheCallback,
    102                void(const ShaderCacheCallback& callback));
    103   MOCK_METHOD1(SetWaitSyncPointCallback,
    104                void(const WaitSyncPointCallback& callback));
    105   MOCK_METHOD1(WaitForReadPixels,
    106                void(base::Closure callback));
    107   MOCK_METHOD0(GetTextureUploadCount, uint32());
    108   MOCK_METHOD0(GetTotalTextureUploadTime, base::TimeDelta());
    109   MOCK_METHOD0(GetTotalProcessingCommandsTime, base::TimeDelta());
    110   MOCK_METHOD1(AddProcessingCommandsTime, void(base::TimeDelta));
    111   MOCK_METHOD0(WasContextLost, bool());
    112   MOCK_METHOD0(WasContextLostByRobustnessExtension, bool());
    113   MOCK_METHOD1(LoseContext, void(uint32 reset_status));
    114 
    115   DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder);
    116 };
    117 
    118 }  // namespace gles2
    119 }  // namespace gpu
    120 
    121 #endif  // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_MOCK_H_
    122