Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ - (void)testMethodInvokeWithReply {
XCTAssertEqual(FlutterMethodNotImplemented, result);
}];
OCMVerifyAll(binaryMessenger);
[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectations:@[ didCallReply ]];
}

- (void)testMethodMessageHandler {
Expand Down Expand Up @@ -141,7 +141,7 @@ - (void)testCallMethodHandler {
[didCallReply fulfill];
XCTAssertEqual(replyEnvelopeData, reply);
});
[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectations:@[ didCallHandler, didCallReply ]];
}

- (void)testResize {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ - (void)testSearchWebInvokedWithEscapedTerm {
};

[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ invokeExpectation ]];
[mockApplication stopMocking];
}

Expand Down Expand Up @@ -90,7 +90,7 @@ - (void)testSearchWebInvokedWithNonEscapedTerm {
};

[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ invokeExpectation ]];
[mockApplication stopMocking];
}

Expand Down Expand Up @@ -119,7 +119,7 @@ - (void)testLookUpCallInitiated {
[presentExpectation fulfill];
};
[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:2 handler:nil];
[self waitForExpectations:@[ presentExpectation ]];
}

- (void)testShareScreenInvoked {
Expand Down Expand Up @@ -151,7 +151,7 @@ - (void)testShareScreenInvoked {
[presentExpectation fulfill];
};
[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ presentExpectation ]];
}

- (void)testShareScreenInvokedOnIPad {
Expand Down Expand Up @@ -186,7 +186,7 @@ - (void)testShareScreenInvokedOnIPad {
[presentExpectation fulfill];
};
[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ presentExpectation ]];
}

- (void)testClipboardHasCorrectStrings {
Expand All @@ -202,7 +202,7 @@ - (void)testClipboardHasCorrectStrings {
[FlutterMethodCall methodCallWithMethodName:@"Clipboard.setData"
arguments:@{@"text" : @"some string"}];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ setStringExpectation ]];

XCTestExpectation* hasStringsExpectation = [self expectationWithDescription:@"hasStrings"];
FlutterResult result = ^(id result) {
Expand All @@ -212,7 +212,7 @@ - (void)testClipboardHasCorrectStrings {
FlutterMethodCall* methodCall =
[FlutterMethodCall methodCallWithMethodName:@"Clipboard.hasStrings" arguments:nil];
[plugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ hasStringsExpectation ]];

XCTestExpectation* getDataExpectation = [self expectationWithDescription:@"getData"];
FlutterResult getDataResult = ^(id result) {
Expand All @@ -222,7 +222,7 @@ - (void)testClipboardHasCorrectStrings {
FlutterMethodCall* methodCallGetData =
[FlutterMethodCall methodCallWithMethodName:@"Clipboard.getData" arguments:@"text/plain"];
[plugin handleMethodCall:methodCallGetData result:getDataResult];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ getDataExpectation ]];
}

- (void)testClipboardSetDataToNullDoNotCrash {
Expand All @@ -247,7 +247,7 @@ - (void)testClipboardSetDataToNullDoNotCrash {
FlutterMethodCall* methodCall = [FlutterMethodCall methodCallWithMethodName:@"Clipboard.getData"
arguments:@"text/plain"];
[plugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ setStringExpectation, getDataExpectation ]];
}

- (void)testPopSystemNavigator {
Expand All @@ -271,7 +271,7 @@ - (void)testPopSystemNavigator {
FlutterMethodCall* methodCallSet =
[FlutterMethodCall methodCallWithMethodName:@"SystemNavigator.pop" arguments:@(YES)];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ navigationPopCalled ]];
OCMVerify([navigationControllerMock popViewControllerAnimated:YES]);

[flutterViewController deregisterNotifications];
Expand All @@ -291,7 +291,7 @@ - (void)testWhetherDeviceHasLiveTextInputInvokeCorrectly {
[invokeExpectation fulfill];
};
[mockPlugin handleMethodCall:methodCall result:result];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ invokeExpectation ]];
}

- (void)testViewControllerBasedStatusBarHiddenUpdate {
Expand All @@ -318,7 +318,7 @@ - (void)testViewControllerBasedStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIOverlays"
arguments:@[ @"SystemUiOverlay.bottom" ]];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIOverlaysCalled ]];
XCTAssertTrue(flutterViewController.prefersStatusBarHidden);

// Update to shown.
Expand All @@ -331,7 +331,7 @@ - (void)testViewControllerBasedStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIOverlays"
arguments:@[ @"SystemUiOverlay.top" ]];
[plugin handleMethodCall:methodCallSet2 result:resultSet2];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIOverlaysCalled2 ]];
XCTAssertFalse(flutterViewController.prefersStatusBarHidden);

[flutterViewController deregisterNotifications];
Expand All @@ -356,7 +356,7 @@ - (void)testViewControllerBasedStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIMode"
arguments:@"SystemUiMode.immersive"];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIModeCalled ]];
XCTAssertTrue(flutterViewController.prefersStatusBarHidden);

// Update to shown.
Expand All @@ -369,7 +369,7 @@ - (void)testViewControllerBasedStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIMode"
arguments:@"SystemUiMode.edgeToEdge"];
[plugin handleMethodCall:methodCallSet2 result:resultSet2];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIModeCalled2 ]];
XCTAssertFalse(flutterViewController.prefersStatusBarHidden);

[flutterViewController deregisterNotifications];
Expand Down Expand Up @@ -402,7 +402,7 @@ - (void)testStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIOverlays"
arguments:@[ @"SystemUiOverlay.bottom" ]];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIOverlaysCalled ]];
#if not APPLICATION_EXTENSION_API_ONLY
OCMVerify([mockApplication setStatusBarHidden:YES]);
#endif
Expand All @@ -417,7 +417,7 @@ - (void)testStatusBarHiddenUpdate {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setEnabledSystemUIOverlays"
arguments:@[ @"SystemUiOverlay.top" ]];
[plugin handleMethodCall:methodCallSet2 result:resultSet2];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIOverlaysCalled2 ]];
#if not APPLICATION_EXTENSION_API_ONLY
OCMVerify([mockApplication setStatusBarHidden:NO]);
#endif
Expand Down Expand Up @@ -451,7 +451,7 @@ - (void)testStatusBarStyle {
[FlutterMethodCall methodCallWithMethodName:@"SystemChrome.setSystemUIOverlayStyle"
arguments:@{@"statusBarBrightness" : @"Brightness.dark"}];
[plugin handleMethodCall:methodCallSet result:resultSet];
[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[ enableSystemUIModeCalled ]];

#if not APPLICATION_EXTENSION_API_ONLY
OCMVerify([mockApplication setStatusBarStyle:UIStatusBarStyleLightContent]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3587,7 +3587,7 @@ - (void)testDisposingViewInCompositionOrderDoNotCrash {

flutterPlatformViewsController->OnMethodCall(
[FlutterMethodCall methodCallWithMethodName:@"dispose" arguments:@0], disposeResult);
[self waitForExpectationsWithTimeout:30 handler:nil];
[self waitForExpectations:@[ expectation ]];

const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000);
sk_sp<SkSurface> mock_sk_surface = SkSurfaces::Raster(image_info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ - (void)testKeyboardAnimationWillWaitUIThreadVsync {
};
CFTimeInterval startTime = CACurrentMediaTime();
[viewController setUpKeyboardAnimationVsyncClient:callback];
[self waitForExpectationsWithTimeout:5.0 handler:nil];
[self waitForExpectations:@[ expectation ]];
XCTAssertTrue(fulfillTime - startTime > delayTime);
}

Expand Down Expand Up @@ -754,7 +754,7 @@ - (void)testHandleKeyboardNotification {
[viewControllerMock handleKeyboardNotification:notification];
XCTAssertTrue(viewControllerMock.targetViewInsetBottom == 320 * screen.scale);
OCMVerify([viewControllerMock startKeyBoardAnimation:0.25]);
[self waitForExpectationsWithTimeout:5.0 handler:nil];
[self waitForExpectations:@[ expectation ]];
}

- (void)testEnsureBottomInsetIsZeroWhenKeyboardDismissed {
Expand Down Expand Up @@ -1661,7 +1661,7 @@ - (void)testWillDeallocNotification {
XCTAssertNotNil(realVC);
realVC = nil;
}
[self waitForExpectations:@[ expectation ] timeout:1.0];
[self waitForExpectations:@[ expectation ]];
}

- (void)testReleasesKeyboardManagerOnDealloc {
Expand Down Expand Up @@ -1943,7 +1943,7 @@ - (void)testLifeCycleNotificationBecameActive {
OCMVerify([mockVC goToApplicationLifecycle:@"AppLifecycleState.resumed"]);
[flutterViewController deregisterNotifications];
});
[self waitForExpectationsWithTimeout:5.0 handler:nil];
[self waitForExpectations:@[ timeoutApplicationLifeCycle ]];
}

- (void)testLifeCycleNotificationWillResignActive {
Expand Down Expand Up @@ -2088,7 +2088,7 @@ - (void)testLifeCycleNotificationCancelledInvalidResumed {
[timeoutApplicationLifeCycle fulfill];
[flutterViewController deregisterNotifications];
});
[self waitForExpectationsWithTimeout:5.0 handler:nil];
[self waitForExpectations:@[ timeoutApplicationLifeCycle ]];
}

- (void)testSetupKeyboardAnimationVsyncClientWillCreateNewVsyncClientForFlutterViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,9 @@ - (void)testTextInputSemanticsObject_editActions {
[partialSemanticsObject selectAll:nil];
[partialSemanticsObject delete:nil];

[self waitForExpectationsWithTimeout:1 handler:nil];
[self waitForExpectations:@[
copyExpectation, cutExpectation, pasteExpectation, selectAllExpectation, deleteExpectation
]];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TaskRunners task_runners(
auto platform_message = std::make_unique<flutter::PlatformMessage>(channel, response);
handler->HandlePlatformMessage(std::move(platform_message));
});
[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectations:@[ didCallReply ]];
XCTAssertTrue(response->is_complete());
}

Expand Down Expand Up @@ -100,7 +100,7 @@ TaskRunners task_runners(
handler->HandlePlatformMessage(std::move(platform_message));
[didCallMessage fulfill];
});
[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectations:@[ didCallMessage ]];
XCTAssertTrue(response->is_complete());
}

Expand Down Expand Up @@ -128,7 +128,7 @@ TaskRunners task_runners(
auto platform_message = std::make_unique<flutter::PlatformMessage>(channel, response);
handler->HandlePlatformMessage(std::move(platform_message));
});
[self waitForExpectationsWithTimeout:1.0 handler:nil];
[self waitForExpectations:@[ didCallReply ]];
XCTAssertTrue(response->is_complete());
}
@end