Flutter Engine
android_surface_mock.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_
6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_
7 
8 #include "flutter/shell/gpu/gpu_surface_gl.h"
9 #include "flutter/shell/platform/android/surface/android_surface.h"
10 #include "gmock/gmock.h"
11 
12 namespace flutter {
13 
14 //------------------------------------------------------------------------------
15 /// Mock for |AndroidSurface|. This implementation can be used in unit
16 /// tests without requiring the Android toolchain.
17 ///
19  public AndroidSurface {
20  public:
21  MOCK_METHOD(bool, IsValid, (), (const, override));
22 
23  MOCK_METHOD(void, TeardownOnScreenContext, (), (override));
24 
25  MOCK_METHOD(std::unique_ptr<Surface>,
27  (GrDirectContext * gr_context),
28  (override));
29 
30  MOCK_METHOD(bool, OnScreenSurfaceResize, (const SkISize& size), (override));
31 
32  MOCK_METHOD(bool, ResourceContextMakeCurrent, (), (override));
33 
34  MOCK_METHOD(bool, ResourceContextClearCurrent, (), (override));
35 
36  MOCK_METHOD(bool,
39  (override));
40 
41  // |GPUSurfaceGLDelegate|
42  std::unique_ptr<GLContextResult> GLContextMakeCurrent() override;
43 
44  // |GPUSurfaceGLDelegate|
45  bool GLContextClearCurrent() override;
46 
47  // |GPUSurfaceGLDelegate|
48  bool GLContextPresent(uint32_t fbo_id) override;
49 
50  // |GPUSurfaceGLDelegate|
51  intptr_t GLContextFBO(GLFrameInfo frame_info) const override;
52 
53  // |GPUSurfaceGLDelegate|
55 };
56 
57 } // namespace flutter
58 
59 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_
virtual void TeardownOnScreenContext()=0
virtual bool SetNativeWindow(fml::RefPtr< AndroidNativeWindow > window)=0
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
bool GLContextPresent(uint32_t fbo_id) override
virtual bool OnScreenSurfaceResize(const SkISize &size)=0
intptr_t GLContextFBO(GLFrameInfo frame_info) const override
MOCK_METHOD(bool, IsValid,(),(const, override))
std::unique_ptr< GLContextResult > GLContextMakeCurrent() override
virtual bool ResourceContextClearCurrent()=0
ExternalViewEmbedder * GetExternalViewEmbedder() override
Gets the view embedder that controls how the Flutter layer hierarchy split into multiple chunks shoul...
virtual bool IsValid() const =0
virtual bool ResourceContextMakeCurrent()=0
virtual std::unique_ptr< Surface > CreateGPUSurface(GrDirectContext *gr_context=nullptr)=0