flutter_flutter/shell/platform/android/surface/android_surface_mock.h
Kaushik Iska 021ff04336
Reverts 2 commits that remove surface dependance on external view embedder (#22468)
* Revert "Remove GetExternalViewEmbedder from surface (#22272)"

This reverts commit 5419f70f173db1c9f2d5db4c289560e68ce9b77b.

* Revert "Rasterizer is initialized with an external view embedder (#22405)"

This reverts commit f95df42e6e3d80f17c2024e9956768be9416717f.
2020-11-12 08:41:11 -08:00

60 lines
1.9 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_
#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/android/surface/android_surface.h"
#include "gmock/gmock.h"
namespace flutter {
//------------------------------------------------------------------------------
/// Mock for |AndroidSurface|. This implementation can be used in unit
/// tests without requiring the Android toolchain.
///
class AndroidSurfaceMock final : public GPUSurfaceGLDelegate,
public AndroidSurface {
public:
MOCK_METHOD(bool, IsValid, (), (const, override));
MOCK_METHOD(void, TeardownOnScreenContext, (), (override));
MOCK_METHOD(std::unique_ptr<Surface>,
CreateGPUSurface,
(GrDirectContext * gr_context),
(override));
MOCK_METHOD(bool, OnScreenSurfaceResize, (const SkISize& size), (override));
MOCK_METHOD(bool, ResourceContextMakeCurrent, (), (override));
MOCK_METHOD(bool, ResourceContextClearCurrent, (), (override));
MOCK_METHOD(bool,
SetNativeWindow,
(fml::RefPtr<AndroidNativeWindow> window),
(override));
// |GPUSurfaceGLDelegate|
std::unique_ptr<GLContextResult> GLContextMakeCurrent() override;
// |GPUSurfaceGLDelegate|
bool GLContextClearCurrent() override;
// |GPUSurfaceGLDelegate|
bool GLContextPresent(uint32_t fbo_id) override;
// |GPUSurfaceGLDelegate|
intptr_t GLContextFBO(GLFrameInfo frame_info) const override;
// |GPUSurfaceGLDelegate|
ExternalViewEmbedder* GetExternalViewEmbedder() override;
};
} // namespace flutter
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_MOCK_H_