Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
jni_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_JNI_JNI_MOCK_H_
6#define FLUTTER_SHELL_PLATFORM_ANDROID_JNI_JNI_MOCK_H_
7
8#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
9#include "gmock/gmock.h"
10
11namespace flutter {
12
13//------------------------------------------------------------------------------
14/// Mock for |PlatformViewAndroidJNI|. This implementation can be used in unit
15/// tests without requiring the Android toolchain.
16///
17class JNIMock final : public PlatformViewAndroidJNI {
18 public:
21 (std::unique_ptr<flutter::PlatformMessage> message,
22 int responseId),
23 (override));
24
27 (int responseId, std::unique_ptr<fml::Mapping> data),
28 (override));
29
32 (std::vector<uint8_t> buffer,
33 std::vector<std::string> strings,
34 std::vector<std::vector<uint8_t>> string_attribute_args),
35 (override));
36
39 (std::vector<uint8_t> actions_buffer,
40 std::vector<std::string> strings),
41 (override));
42
43 MOCK_METHOD(void, FlutterViewOnFirstFrame, (), (override));
44
46
49 (JavaLocalRef surface_texture, int textureId),
50 (override));
51
54 (JavaLocalRef surface_texture),
55 (override));
56
59 (JavaLocalRef surface_texture),
60 (override));
61
64 (JavaLocalRef surface_texture, SkMatrix& transform),
65 (override));
66
69 (JavaLocalRef image_texture_entry),
70 (override));
71
75 (override));
76
78
81 (JavaLocalRef hardware_buffer),
82 (override));
83
86 (JavaLocalRef surface_texture),
87 (override));
88
91 (int view_id,
92 int x,
93 int y,
94 int width,
95 int height,
96 int viewWidth,
97 int viewHeight,
98 MutatorsStack mutators_stack),
99 (override));
100
103 (int surface_id, int x, int y, int width, int height),
104 (override));
105
106 MOCK_METHOD(void, FlutterViewBeginFrame, (), (override));
107
108 MOCK_METHOD(void, FlutterViewEndFrame, (), (override));
109
110 MOCK_METHOD(std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>,
112 (),
113 (override));
114
116
117 MOCK_METHOD(std::unique_ptr<std::vector<std::string>>,
119 (std::vector<std::string> supported_locales_data),
120 (override));
121
122 MOCK_METHOD(double, GetDisplayRefreshRate, (), (override));
123 MOCK_METHOD(double, GetDisplayWidth, (), (override));
124 MOCK_METHOD(double, GetDisplayHeight, (), (override));
125 MOCK_METHOD(double, GetDisplayDensity, (), (override));
126
129 (int loading_unit_id),
130 (override));
131
134 (double font_size, int configuration_id),
135 (const, override));
136};
137
138} // namespace flutter
139
140#endif // FLUTTER_SHELL_PLATFORM_ANDROID_JNI_JNI_MOCK_H_
MOCK_METHOD(double, GetDisplayWidth,(),(override))
MOCK_METHOD(void, FlutterViewOnDisplayPlatformView,(int view_id, int x, int y, int width, int height, int viewWidth, int viewHeight, MutatorsStack mutators_stack),(override))
MOCK_METHOD(void, SurfaceTextureAttachToGLContext,(JavaLocalRef surface_texture, int textureId),(override))
MOCK_METHOD(void, FlutterViewEndFrame,(),(override))
MOCK_METHOD(JavaLocalRef, ImageProducerTextureEntryAcquireLatestImage,(JavaLocalRef image_texture_entry),(override))
MOCK_METHOD(JavaLocalRef, ImageGetHardwareBuffer,(JavaLocalRef image),(override))
MOCK_METHOD(void, HardwareBufferClose,(JavaLocalRef hardware_buffer),(override))
MOCK_METHOD(void, FlutterViewUpdateSemantics,(std::vector< uint8_t > buffer, std::vector< std::string > strings, std::vector< std::vector< uint8_t > > string_attribute_args),(override))
MOCK_METHOD(std::unique_ptr< PlatformViewAndroidJNI::OverlayMetadata >, FlutterViewCreateOverlaySurface,(),(override))
MOCK_METHOD(bool, RequestDartDeferredLibrary,(int loading_unit_id),(override))
MOCK_METHOD(void, SurfaceTextureGetTransformMatrix,(JavaLocalRef surface_texture, SkMatrix &transform),(override))
MOCK_METHOD(double, GetDisplayDensity,(),(override))
MOCK_METHOD(void, FlutterViewDisplayOverlaySurface,(int surface_id, int x, int y, int width, int height),(override))
MOCK_METHOD(void, FlutterViewBeginFrame,(),(override))
MOCK_METHOD(double, GetDisplayHeight,(),(override))
MOCK_METHOD(double, GetDisplayRefreshRate,(),(override))
MOCK_METHOD(void, ImageClose,(JavaLocalRef image),(override))
MOCK_METHOD(void, FlutterViewOnFirstFrame,(),(override))
MOCK_METHOD(std::unique_ptr< std::vector< std::string > >, FlutterViewComputePlatformResolvedLocale,(std::vector< std::string > supported_locales_data),(override))
MOCK_METHOD(void, SurfaceTextureUpdateTexImage,(JavaLocalRef surface_texture),(override))
MOCK_METHOD(bool, SurfaceTextureShouldUpdate,(JavaLocalRef surface_texture),(override))
MOCK_METHOD(void, FlutterViewHandlePlatformMessage,(std::unique_ptr< flutter::PlatformMessage > message, int responseId),(override))
MOCK_METHOD(void, SurfaceTextureDetachFromGLContext,(JavaLocalRef surface_texture),(override))
MOCK_METHOD(void, FlutterViewDestroyOverlaySurfaces,(),(override))
MOCK_METHOD(void, FlutterViewHandlePlatformMessageResponse,(int responseId, std::unique_ptr< fml::Mapping > data),(override))
MOCK_METHOD(double, FlutterViewGetScaledFontSize,(double font_size, int configuration_id),(const, override))
MOCK_METHOD(void, FlutterViewUpdateCustomAccessibilityActions,(std::vector< uint8_t > actions_buffer, std::vector< std::string > strings),(override))
MOCK_METHOD(void, FlutterViewOnPreEngineRestart,(),(override))
virtual void FlutterViewHandlePlatformMessageResponse(int responseId, std::unique_ptr< fml::Mapping > data)=0
Responds to a platform message. The data may be a nullptr.
virtual JavaLocalRef ImageProducerTextureEntryAcquireLatestImage(JavaLocalRef image_texture_entry)=0
Acquire the latest image available.
virtual void FlutterViewBeginFrame()=0
Initiates a frame if using hybrid composition.
virtual void SurfaceTextureUpdateTexImage(JavaLocalRef surface_texture)=0
Updates the texture image to the most recent frame from the image stream.
virtual void SurfaceTextureAttachToGLContext(JavaLocalRef surface_texture, int textureId)=0
Attach the SurfaceTexture to the OpenGL ES context that is current on the calling thread.
virtual JavaLocalRef ImageGetHardwareBuffer(JavaLocalRef image)=0
Grab the HardwareBuffer from image.
virtual void SurfaceTextureGetTransformMatrix(JavaLocalRef surface_texture, SkMatrix &transform)=0
Gets the transform matrix from the SurfaceTexture. Then, it updates the transform matrix,...
virtual void FlutterViewDestroyOverlaySurfaces()=0
Destroys the overlay surfaces.
virtual double GetDisplayDensity()=0
virtual double GetDisplayRefreshRate()=0
virtual void FlutterViewEndFrame()=0
Indicates that the current frame ended. It's used to clean up state.
virtual void SurfaceTextureDetachFromGLContext(JavaLocalRef surface_texture)=0
Detaches a SurfaceTexture from the OpenGL ES context.
virtual void FlutterViewDisplayOverlaySurface(int surface_id, int x, int y, int width, int height)=0
Positions and sizes an overlay surface in hybrid composition.
virtual void HardwareBufferClose(JavaLocalRef hardware_buffer)=0
Call close on hardware_buffer.
virtual void FlutterViewHandlePlatformMessage(std::unique_ptr< flutter::PlatformMessage > message, int responseId)=0
Sends a platform message. The message may be empty.
virtual void ImageClose(JavaLocalRef image)=0
Call close on image.
virtual void FlutterViewUpdateCustomAccessibilityActions(std::vector< uint8_t > actions_buffer, std::vector< std::string > strings)=0
Sends new custom accessibility events.
virtual void FlutterViewOnFirstFrame()=0
Indicates that FlutterView should start painting pixels.
virtual double FlutterViewGetScaledFontSize(double unscaled_font_size, int configuration_id) const =0
virtual void FlutterViewOnDisplayPlatformView(int view_id, int x, int y, int width, int height, int viewWidth, int viewHeight, MutatorsStack mutators_stack)=0
Positions and sizes a platform view if using hybrid composition.
virtual bool SurfaceTextureShouldUpdate(JavaLocalRef surface_texture)=0
Returns true if surface_texture should be updated.
virtual void FlutterViewUpdateSemantics(std::vector< uint8_t > buffer, std::vector< std::string > strings, std::vector< std::vector< uint8_t > > string_attribute_args)=0
Sends semantics tree updates.
virtual std::unique_ptr< std::vector< std::string > > FlutterViewComputePlatformResolvedLocale(std::vector< std::string > supported_locales_data)=0
Computes the locale Android would select.
virtual bool RequestDartDeferredLibrary(int loading_unit_id)=0
virtual double GetDisplayWidth()=0
virtual std::unique_ptr< PlatformViewAndroidJNI::OverlayMetadata > FlutterViewCreateOverlaySurface()=0
Instantiates an overlay surface in hybrid composition and provides the necessary metadata to operate ...
virtual void FlutterViewOnPreEngineRestart()=0
Indicates that a hot restart is about to happen.
virtual double GetDisplayHeight()=0
sk_sp< SkImage > image
Definition examples.cpp:29
Win32Message message
double y
double x
std::nullptr_t JavaLocalRef
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition switches.h:126
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition p3.cpp:47
int32_t height
int32_t width