Flutter Engine
 
Loading...
Searching...
No Matches
windows_test_config_builder.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_WINDOWS_TESTING_WINDOWS_TEST_CONFIG_BUILDER_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_WINDOWS_TEST_CONFIG_BUILDER_H_
7
8#include <string>
9#include <string_view>
10#include <vector>
11
12#include "flutter/fml/macros.h"
16
17namespace flutter {
18namespace testing {
19
20// Deleter for FlutterDesktopEngineRef objects.
27
28// Unique pointer wrapper for FlutterDesktopEngineRef.
29using EnginePtr = std::unique_ptr<FlutterDesktopEngine, EngineDeleter>;
30
31// Deleter for FlutterViewControllerRef objects.
38
39// Unique pointer wrapper for FlutterDesktopViewControllerRef.
41 std::unique_ptr<FlutterDesktopViewController, ViewControllerDeleter>;
42
43// Test configuration builder for WindowsTests.
44//
45// Utility class for configuring engine and view controller launch arguments,
46// and launching the engine to run a test fixture.
48 public:
51
52 // Returns the desktop engine properties configured for this test.
54
55 // Sets the Dart entrypoint to the specified value.
56 //
57 // If not set, the default entrypoint (main) is used. Custom Dart entrypoints
58 // must be decorated with `@pragma('vm:entry-point')`.
59 void SetDartEntrypoint(std::string_view entrypoint);
60
61 // Set the UI Thread policy for the engine.
62 // If not set defaults to FlutterDesktopUIThreadPolicy::Default;
64
65 // Adds an argument to the Dart entrypoint arguments List<String>.
66 void AddDartEntrypointArgument(std::string_view arg);
67
69
70 // Returns a configured and initialized engine.
72
73 // Returns a configured and initialized engine that runs the configured Dart
74 // entrypoint.
75 //
76 // Returns null on failure.
77 EnginePtr RunHeadless() const;
78
79 // Returns a configured and initialized view controller that runs the
80 // configured Dart entrypoint and owns its engine.
81 //
82 // Returns null on failure.
83 ViewControllerPtr Run() const;
84
85 private:
86 // Initialize COM, so that it is available for use in the library and/or
87 // plugins.
88 void InitializeCOM() const;
89
90 WindowsTestContext& context_;
91 std::string dart_entrypoint_;
92 std::vector<std::string> dart_entrypoint_arguments_;
93 FlutterDesktopUIThreadPolicy ui_thread_policy_ =
95
96 FlutterDesktopGpuPreference gpu_preference_ =
98
100};
101
102} // namespace testing
103} // namespace flutter
104
105#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_WINDOWS_TEST_CONFIG_BUILDER_H_
FlutterDesktopEngineProperties GetEngineProperties() const
void SetDartEntrypoint(std::string_view entrypoint)
void SetUIThreadPolicy(FlutterDesktopUIThreadPolicy policy)
void SetGpuPreference(FlutterDesktopGpuPreference gpu_preference)
FlutterEngine engine
Definition main.cc:84
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef
FlutterDesktopUIThreadPolicy
@ Default
FlutterDesktopGpuPreference
@ NoPreference
#define FML_CHECK(condition)
Definition logging.h:104
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
std::unique_ptr< FlutterDesktopEngine, EngineDeleter > EnginePtr
std::unique_ptr< FlutterDesktopViewController, ViewControllerDeleter > ViewControllerPtr
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
void operator()(FlutterDesktopEngineRef engine)
void operator()(FlutterDesktopViewControllerRef controller)
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef controller)
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)