Flutter Engine
The Flutter Engine
stub_flutter_windows_api.cc
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#include "flutter/shell/platform/windows/client_wrapper/testing/stub_flutter_windows_api.h"
6
8
9namespace flutter {
10namespace testing {
11
12// static
15}
16
17// static
20}
21
23 std::unique_ptr<StubFlutterWindowsApi> stub)
24 : stub_(std::move(stub)) {
25 previous_stub_ = StubFlutterWindowsApi::GetTestStub();
27}
28
31}
32
33} // namespace testing
34} // namespace flutter
35
36// Forwarding dummy implementations of the C API.
37
39 int width,
40 int height,
44 }
45 return nullptr;
46}
47
52 }
53}
54
57 // The stub ignores this, so just return an arbitrary non-zero value.
58 return static_cast<FlutterDesktopViewId>(1);
59}
60
63 // The stub ignores this, so just return an arbitrary non-zero value.
64 return reinterpret_cast<FlutterDesktopEngineRef>(1);
65}
66
69 // The stub ignores this, so just return an arbitrary non-zero value.
70 return reinterpret_cast<FlutterDesktopViewRef>(1);
71}
72
77 }
78}
79
82 HWND hwnd,
84 WPARAM wparam,
85 LPARAM lparam,
86 LRESULT* result) {
89 hwnd, message, wparam, lparam, result);
90 }
91 return false;
92}
93
95 const FlutterDesktopEngineProperties* engine_properties) {
97 return s_stub_implementation->EngineCreate(*engine_properties);
98 }
99 return nullptr;
100}
101
105 }
106 return true;
107}
108
110 const char* entry_point) {
112 return s_stub_implementation->EngineRun(entry_point);
113 }
114 return true;
115}
116
120 }
121 return 0;
122}
123
126 void* user_data) {
129 }
130}
131
135 }
136}
137
140 const char* plugin_name) {
141 // The stub ignores this, so just return an arbitrary non-zero value.
142 return reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
143}
144
147 // The stub ignores this, so just return an arbitrary non-zero value.
148 return reinterpret_cast<FlutterDesktopMessengerRef>(2);
149}
150
153 // The stub ignores this, so just return an arbitrary non-zero value.
154 return reinterpret_cast<FlutterDesktopTextureRegistrarRef>(3);
155}
156
160 }
161 return reinterpret_cast<HWND>(-1);
162}
163
167 }
168 return nullptr;
169}
170
173 HWND hwnd,
175 WPARAM wparam,
176 LPARAM lparam,
177 LRESULT* result) {
180 engine, hwnd, message, wparam, lparam, result);
181 }
182 return false;
183}
184
187 const char* view_type_name,
191 view_type);
192 }
193}
194
199 }
200 return nullptr;
201}
202
205 FlutterDesktopViewId view_id) {
208 }
209 return nullptr;
210}
211
215 void* user_data) {
219 user_data);
220 }
221}
222
229 }
230}
ScopedStubFlutterWindowsApi(std::unique_ptr< StubFlutterWindowsApi > stub)
virtual bool ViewControllerHandleTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
virtual void EngineSetNextFrameCallback(VoidCallback callback, void *user_data)
virtual FlutterDesktopEngineRef EngineCreate(const FlutterDesktopEngineProperties &engine_properties)
virtual FlutterDesktopViewRef PluginRegistrarGetViewById(FlutterDesktopViewId view_id)
virtual FlutterDesktopViewControllerRef ViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine)
virtual bool EngineRun(const char *entry_point)
virtual void EngineRegisterPlatformViewType(const char *view_type_name, FlutterPlatformViewTypeEntry view_type)
static void SetTestStub(StubFlutterWindowsApi *stub)
static StubFlutterWindowsApi * GetTestStub()
virtual void PluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
virtual FlutterDesktopViewRef PluginRegistrarGetView()
virtual void PluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)
virtual bool EngineProcessExternalWindowMessage(FlutterDesktopEngineRef engine, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
FlutterEngine engine
Definition: main.cc:68
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
GAsyncResult * result
struct FlutterDesktopTextureRegistrar * FlutterDesktopTextureRegistrarRef
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
int64_t FlutterDesktopViewId
struct FlutterDesktopView * FlutterDesktopViewRef
Win32Message message
Definition: ref_ptr.h:256
int32_t height
int32_t width
HWND FlutterDesktopViewGetHWND(FlutterDesktopViewRef controller)
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef controller)
FlutterDesktopEngineRef FlutterDesktopEngineCreate(const FlutterDesktopEngineProperties *engine_properties)
void FlutterDesktopEngineReloadSystemFonts(FlutterDesktopEngineRef engine)
bool FlutterDesktopEngineProcessExternalWindowMessage(FlutterDesktopEngineRef engine, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
FlutterDesktopViewId FlutterDesktopViewControllerGetViewId(FlutterDesktopViewControllerRef controller)
void FlutterDesktopEngineRegisterPlatformViewType(FlutterDesktopEngineRef engine, const char *view_type_name, FlutterPlatformViewTypeEntry view_type)
FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar(FlutterDesktopEngineRef engine, const char *plugin_name)
FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine)
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)
FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine(FlutterDesktopViewControllerRef controller)
bool FlutterDesktopViewControllerHandleTopLevelWindowProc(FlutterDesktopViewControllerRef controller, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
FlutterDesktopViewRef FlutterDesktopViewControllerGetView(FlutterDesktopViewControllerRef controller)
FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar(FlutterDesktopEngineRef engine)
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
uint64_t FlutterDesktopEngineProcessMessages(FlutterDesktopEngineRef engine)
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(FlutterDesktopEngineRef engine)
void FlutterDesktopViewControllerForceRedraw(FlutterDesktopViewControllerRef controller)
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef controller)
IDXGIAdapter * FlutterDesktopViewGetGraphicsAdapter(FlutterDesktopViewRef view)
void FlutterDesktopEngineSetNextFrameCallback(FlutterDesktopEngineRef engine, VoidCallback callback, void *user_data)
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(FlutterDesktopPluginRegistrarRef controller, FlutterDesktopViewId view_id)
bool FlutterDesktopEngineRun(FlutterDesktopEngineRef engine, const char *entry_point)
void * user_data
LONG_PTR LRESULT
Definition: windows_types.h:61
unsigned int UINT
Definition: windows_types.h:32
LONG_PTR LPARAM
Definition: windows_types.h:60
UINT_PTR WPARAM
Definition: windows_types.h:59