Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
FlutterEngine+ScenariosTest.m
Go to the documentation of this file.
1// Copyright 2019 The Chromium 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
6
7@implementation FlutterEngine (ScenariosTest)
8
9- (instancetype)initWithScenario:(NSString*)scenario
10 withCompletion:(nullable void (^)(void))engineRunCompletion {
11 NSAssert([scenario length] != 0, @"You need to provide a scenario");
12 self = [self initWithName:[NSString stringWithFormat:@"Test engine for %@", scenario]
13 project:nil];
14 [self run];
15
16 [self.binaryMessenger setMessageHandlerOnChannel:@"waiting_for_status"
17 binaryMessageHandler:^(NSData* message, FlutterBinaryReply reply) {
19 methodChannelWithName:@"driver"
20 binaryMessenger:self.binaryMessenger
22 [channel invokeMethod:@"set_scenario"
23 arguments:@{@"name" : scenario}];
24
25 if (engineRunCompletion != nil) {
26 engineRunCompletion();
27 }
28 }];
29 return self;
30}
31
32@end
FlutterBinaryMessengerConnection setMessageHandlerOnChannel:binaryMessageHandler:(NSString *channel, [binaryMessageHandler] FlutterBinaryMessageHandler handler)
instancetype initWithName:project:(NSString *labelPrefix,[project] nullable FlutterDartProject *project)
instancetype sharedInstance()
instancetype methodChannelWithName:binaryMessenger:codec:(NSString *name,[binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger,[codec] NSObject< FlutterMethodCodec > *codec)
size_t length