Skip to content

Commit

Permalink
Stopped mocking the a flutter engine to make sure we delete the (flut…
Browse files Browse the repository at this point in the history
…ter#23013)

FlutterViewController.
  • Loading branch information
gaaclarke authored Dec 11, 2020
1 parent 7bdaf37 commit 1b0dc61
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,22 @@ - (void)testViewDidDisappearDoesPauseEngineWhenIsTheViewController {
}

- (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
Expand Down

0 comments on commit 1b0dc61

Please sign in to comment.