Flutter Engine
The 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"
13#include "flutter/fml/unique_object.h"
14#include "flutter/shell/platform/windows/public/flutter_windows.h"
15#include "flutter/shell/platform/windows/testing/windows_test_context.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 // Adds an argument to the Dart entrypoint arguments List<String>.
62 void AddDartEntrypointArgument(std::string_view arg);
63
64 // Returns a configured and initialized engine.
66
67 // Returns a configured and initialized engine that runs the configured Dart
68 // entrypoint.
69 //
70 // Returns null on failure.
71 EnginePtr RunHeadless() const;
72
73 // Returns a configured and initialized view controller that runs the
74 // configured Dart entrypoint and owns its engine.
75 //
76 // Returns null on failure.
77 ViewControllerPtr Run() const;
78
79 private:
80 // Initialize COM, so that it is available for use in the library and/or
81 // plugins.
82 void InitializeCOM() const;
83
84 WindowsTestContext& context_;
85 std::string dart_entrypoint_;
86 std::vector<std::string> dart_entrypoint_arguments_;
87
89};
90
91} // namespace testing
92} // namespace flutter
93
94#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_TESTING_WINDOWS_TEST_CONFIG_BUILDER_H_
FlutterDesktopEngineProperties GetEngineProperties() const
void SetDartEntrypoint(std::string_view entrypoint)
FlutterEngine engine
Definition main.cc:68
struct FlutterDesktopViewController * FlutterDesktopViewControllerRef
#define FML_CHECK(condition)
Definition logging.h:85
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
std::unique_ptr< FlutterDesktopEngine, EngineDeleter > EnginePtr
std::unique_ptr< FlutterDesktopViewController, ViewControllerDeleter > ViewControllerPtr
void operator()(FlutterDesktopEngineRef engine)
void operator()(FlutterDesktopViewControllerRef controller)
void FlutterDesktopViewControllerDestroy(FlutterDesktopViewControllerRef controller)
bool FlutterDesktopEngineDestroy(FlutterDesktopEngineRef engine_ref)