Stopped mocking the a flutter engine to make sure we delete the (flutter/engine#23013)

FlutterViewController.
This commit is contained in:
gaaclarke 2020-12-11 09:40:07 -08:00 committed by GitHub
parent e6407ec378
commit ace14e2877

View File

@ -101,15 +101,22 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
- (void)testBinaryMessenger {
id engine = OCMClassMock([FlutterEngine class]);
FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine
nibName:nil
bundle:nil];
XCTAssertNotNil(vc);
id messenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
OCMStub([engine binaryMessenger]).andReturn(messenger);
XCTAssertEqual(vc.binaryMessenger, messenger);
OCMVerify([engine binaryMessenger]);
__weak FlutterViewController* weakVC;
@autoreleasepool {
id engine = OCMClassMock([FlutterEngine class]);
FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine
nibName:nil
bundle:nil];
XCTAssertNotNil(vc);
weakVC = vc;
id messenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
OCMStub([engine binaryMessenger]).andReturn(messenger);
XCTAssertEqual(vc.binaryMessenger, messenger);
OCMVerify([engine binaryMessenger]);
// This had to be added to make sure the view controller is deleted.
[engine stopMocking];
}
XCTAssertNil(weakVC);
}
#pragma mark - Platform Brightness