Flutter macOS Embedder
flutter::testing::FlutterEngineTest Class Reference

#include <FlutterEngineTestUtils.h>

Inheritance diagram for flutter::testing::FlutterEngineTest:

Public Member Functions

 FlutterEngineTest ()
 
FlutterEngineGetFlutterEngine ()
 
void SetUp () override
 
void TearDown () override
 
void AddNativeCallback (const char *name, Dart_NativeFunction function)
 
void ShutDownEngine ()
 

Static Public Member Functions

static void IsolateCreateCallback (void *user_data)
 

Detailed Description

Definition at line 18 of file FlutterEngineTestUtils.h.

Constructor & Destructor Documentation

◆ FlutterEngineTest()

flutter::testing::FlutterEngineTest::FlutterEngineTest ( )
default

Member Function Documentation

◆ AddNativeCallback()

void flutter::testing::FlutterEngineTest::AddNativeCallback ( const char *  name,
Dart_NativeFunction  function 
)

Definition at line 72 of file FlutterEngineTestUtils.mm.

72  {
73  native_resolver_->AddNativeCallback({name}, function);
74 }

◆ GetFlutterEngine()

FlutterEngine* flutter::testing::FlutterEngineTest::GetFlutterEngine ( )
inline

Definition at line 22 of file FlutterEngineTestUtils.h.

22 { return engine_; };

◆ IsolateCreateCallback()

void flutter::testing::FlutterEngineTest::IsolateCreateCallback ( void *  user_data)
static

Definition at line 68 of file FlutterEngineTestUtils.mm.

68  {
69  native_resolver_->SetNativeResolverForIsolate();
70 }

◆ SetUp()

void flutter::testing::FlutterEngineTest::SetUp ( )
override

Definition at line 45 of file FlutterEngineTestUtils.mm.

45  {
46  native_resolver_ = std::make_shared<TestDartNativeResolver>();
47  NSString* fixtures = @(testing::GetFixturesPath());
48  project_ = [[FlutterDartProject alloc]
49  initWithAssetsPath:fixtures
50  ICUDataPath:[fixtures stringByAppendingString:@"/icudtl.dat"]];
51  project_.rootIsolateCreateCallback = FlutterEngineTest::IsolateCreateCallback;
52  engine_ = [[FlutterEngine alloc] initWithName:@"test"
53  project:project_
54  allowHeadlessExecution:true];
55 }

◆ ShutDownEngine()

void flutter::testing::FlutterEngineTest::ShutDownEngine ( )

Definition at line 63 of file FlutterEngineTestUtils.mm.

63  {
64  [engine_ shutDownEngine];
65  engine_ = nil;
66 }

References FlutterEngine::shutDownEngine.

◆ TearDown()

void flutter::testing::FlutterEngineTest::TearDown ( )
override

Definition at line 57 of file FlutterEngineTestUtils.mm.

57  {
58  [engine_ shutDownEngine];
59  engine_ = nil;
60  native_resolver_.reset();
61 }

References FlutterEngine::shutDownEngine.


The documentation for this class was generated from the following files:
FlutterEngine
Definition: FlutterEngine.h:31
FlutterDartProject
Definition: FlutterDartProject.mm:24
flutter::testing::FlutterEngineTest::IsolateCreateCallback
static void IsolateCreateCallback(void *user_data)
Definition: FlutterEngineTestUtils.mm:68