Flutter Engine
The Flutter Engine
Instance Methods | List of all members
FlutterEngineGroupTest Class Reference
Inheritance diagram for FlutterEngineGroupTest:

Instance Methods

(void) - testMake [implementation]
 
(void) - testSpawn [implementation]
 
(void) - testDeleteLastEngine [implementation]
 
(void) - testCustomEntrypoint [implementation]
 
(void) - testCustomInitialRoute [implementation]
 
(void) - testCustomEntrypointArgs [implementation]
 
(void) - testReleasesProjectOnDealloc [implementation]
 

Detailed Description

Definition at line 17 of file FlutterEngineGroupTest.mm.

Method Documentation

◆ testCustomEntrypoint

- (void) testCustomEntrypoint
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

49 {
50 FlutterEngineGroup* group = OCMPartialMock([[FlutterEngineGroup alloc] initWithName:@"foo"
51 project:nil]);
52 FlutterEngine* mockEngine = OCMClassMock([FlutterEngine class]);
53 OCMStub([group makeEngine]).andReturn(mockEngine);
54 OCMStub([mockEngine spawnWithEntrypoint:[OCMArg any]
55 libraryURI:[OCMArg any]
56 initialRoute:[OCMArg any]
57 entrypointArgs:[OCMArg any]])
58 .andReturn(OCMClassMock([FlutterEngine class]));
59 FlutterEngine* spawner = [group makeEngineWithEntrypoint:@"firstEntrypoint"
60 libraryURI:@"firstLibraryURI"];
61 XCTAssertNotNil(spawner);
62 OCMVerify([spawner runWithEntrypoint:@"firstEntrypoint"
63 libraryURI:@"firstLibraryURI"
64 initialRoute:nil
65 entrypointArgs:nil]);
66
67 FlutterEngine* spawnee = [group makeEngineWithEntrypoint:@"secondEntrypoint"
68 libraryURI:@"secondLibraryURI"];
69 XCTAssertNotNil(spawnee);
70 OCMVerify([spawner spawnWithEntrypoint:@"secondEntrypoint"
71 libraryURI:@"secondLibraryURI"
72 initialRoute:nil
73 entrypointArgs:nil]);
74}
FlutterEngine * makeEngineWithEntrypoint:libraryURI:(nullable NSString *entrypoint,[libraryURI] nullable NSString *libraryURI)
SIT bool any(const Vec< 1, T > &x)
Definition: SkVx.h:530

◆ testCustomEntrypointArgs

- (void) testCustomEntrypointArgs
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

98 {
99 FlutterEngineGroup* group = OCMPartialMock([[FlutterEngineGroup alloc] initWithName:@"foo"
100 project:nil]);
101 FlutterEngine* mockEngine = OCMClassMock([FlutterEngine class]);
102 OCMStub([group makeEngine]).andReturn(mockEngine);
103 OCMStub([mockEngine spawnWithEntrypoint:[OCMArg any]
104 libraryURI:[OCMArg any]
105 initialRoute:[OCMArg any]
106 entrypointArgs:[OCMArg any]])
107 .andReturn(OCMClassMock([FlutterEngine class]));
108 FlutterEngineGroupOptions* firstOptions = [[FlutterEngineGroupOptions alloc] init];
109 NSArray* firstEntrypointArgs = @[ @"foo", @"first" ];
110 firstOptions.entrypointArgs = firstEntrypointArgs;
111 FlutterEngine* spawner = [group makeEngineWithOptions:firstOptions];
112 XCTAssertNotNil(spawner);
113 OCMVerify([spawner runWithEntrypoint:nil
114 libraryURI:nil
115 initialRoute:nil
116 entrypointArgs:firstEntrypointArgs]);
117
118 NSArray* secondEntrypointArgs = @[ @"bar", @"second" ];
119 FlutterEngineGroupOptions* secondOptions = [[FlutterEngineGroupOptions alloc] init];
120 secondOptions.entrypointArgs = secondEntrypointArgs;
121 FlutterEngine* spawnee = [group makeEngineWithOptions:secondOptions];
122 XCTAssertNotNil(spawnee);
123 OCMVerify([spawner spawnWithEntrypoint:nil
124 libraryURI:nil
125 initialRoute:nil
126 entrypointArgs:secondEntrypointArgs]);
127}
NSArray< NSString * > * entrypointArgs
FlutterEngine * makeEngineWithOptions:(nullable FlutterEngineGroupOptions *options)

◆ testCustomInitialRoute

- (void) testCustomInitialRoute
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

76 {
77 FlutterEngineGroup* group = OCMPartialMock([[FlutterEngineGroup alloc] initWithName:@"foo"
78 project:nil]);
79 FlutterEngine* mockEngine = OCMClassMock([FlutterEngine class]);
80 OCMStub([group makeEngine]).andReturn(mockEngine);
81 OCMStub([mockEngine spawnWithEntrypoint:[OCMArg any]
82 libraryURI:[OCMArg any]
83 initialRoute:[OCMArg any]
84 entrypointArgs:[OCMArg any]])
85 .andReturn(OCMClassMock([FlutterEngine class]));
86 FlutterEngine* spawner = [group makeEngineWithEntrypoint:nil libraryURI:nil initialRoute:@"foo"];
87 XCTAssertNotNil(spawner);
88 OCMVerify([spawner runWithEntrypoint:nil libraryURI:nil initialRoute:@"foo" entrypointArgs:nil]);
89
90 FlutterEngine* spawnee = [group makeEngineWithEntrypoint:nil libraryURI:nil initialRoute:@"bar"];
91 XCTAssertNotNil(spawnee);
92 OCMVerify([spawner spawnWithEntrypoint:nil
93 libraryURI:nil
94 initialRoute:@"bar"
95 entrypointArgs:nil]);
96}
FlutterEngine * makeEngineWithEntrypoint:libraryURI:initialRoute:(nullable NSString *entrypoint,[libraryURI] nullable NSString *libraryURI,[initialRoute] nullable NSString *initialRoute)

◆ testDeleteLastEngine

- (void) testDeleteLastEngine
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

39 {
40 FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo" project:nil];
41 @autoreleasepool {
42 FlutterEngine* spawner = [group makeEngineWithEntrypoint:nil libraryURI:nil];
43 XCTAssertNotNil(spawner);
44 }
45 FlutterEngine* spawnee = [group makeEngineWithEntrypoint:nil libraryURI:nil];
46 XCTAssertNotNil(spawnee);
47}

◆ testMake

- (void) testMake
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

22 {
23 FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo" project:nil];
25 XCTAssertNotNil(engine);
26}
FlutterEngine engine
Definition: main.cc:68

◆ testReleasesProjectOnDealloc

- (void) testReleasesProjectOnDealloc
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

129 {
130 __weak FlutterDartProject* weakProject;
131 @autoreleasepool {
132 FlutterDartProject* mockProject = OCMClassMock([FlutterDartProject class]);
133 FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo"
134 project:mockProject];
135 XCTAssertNotNil(group);
136 weakProject = mockProject;
137 XCTAssertNotNil(weakProject);
138 group = nil;
139 mockProject = nil;
140 }
141 XCTAssertNil(weakProject);
142}

◆ testSpawn

- (void) testSpawn
implementation

Definition at line 11 of file FlutterEngineGroupTest.mm.

28 {
29 FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo" project:nil];
30 FlutterEngine* spawner = [group makeEngineWithEntrypoint:nil libraryURI:nil];
31 spawner.isGpuDisabled = YES;
32 FlutterEngine* spawnee = [group makeEngineWithEntrypoint:nil libraryURI:nil];
33 XCTAssertNotNil(spawner);
34 XCTAssertNotNil(spawnee);
35 XCTAssertEqual(&spawner.threadHost, &spawnee.threadHost);
36 XCTAssertEqual(spawner.isGpuDisabled, spawnee.isGpuDisabled);
37}
const flutter::ThreadHost & threadHost()

The documentation for this class was generated from the following file: