diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 64d53602adebd..1134b735c68fe 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -2104,6 +2104,15 @@ - (int32_t)accessibilityFlags { return flags; } +- (BOOL)accessibilityPerformEscape { + FlutterMethodChannel* navigationChannel = [_engine.get() navigationChannel]; + if (navigationChannel) { + [self popRoute]; + return YES; + } + return NO; +} + + (BOOL)accessibilityIsOnOffSwitchLabelsEnabled { if (@available(iOS 13, *)) { return UIAccessibilityIsOnOffSwitchLabelsEnabled(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm index a68a55287fb42..c0c66796dc63c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm @@ -1365,6 +1365,22 @@ - (void)testItReportsAccessibilityOnOffSwitchLabelsFlagSet { XCTAssert((flags & (int32_t)flutter::AccessibilityFeatureFlag::kOnOffSwitchLabels) != 0); } +- (void)testAccessibilityPerformEscapePopsRoute { + FlutterEngine* mockEngine = OCMPartialMock([[FlutterEngine alloc] init]); + [mockEngine createShell:@"" libraryURI:@"" initialRoute:nil]; + id mockNavigationChannel = OCMClassMock([FlutterMethodChannel class]); + OCMStub([mockEngine navigationChannel]).andReturn(mockNavigationChannel); + + FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:mockEngine + nibName:nil + bundle:nil]; + XCTAssertTrue([viewController accessibilityPerformEscape]); + + OCMVerify([mockNavigationChannel invokeMethod:@"popRoute" arguments:nil]); + + [mockNavigationChannel stopMocking]; +} + - (void)testPerformOrientationUpdateForcesOrientationChange { [self orientationTestWithOrientationUpdate:UIInterfaceOrientationMaskPortrait currentOrientation:UIInterfaceOrientationLandscapeLeft diff --git a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj index e67b60cdfcbc3..0ff04e310ac72 100644 --- a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj +++ b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj @@ -50,7 +50,6 @@ 0AC232F724BA71D300A85907 /* FlutterEngineTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterEngineTest.mm; sourceTree = ""; }; 0AC2330324BA71D300A85907 /* accessibility_bridge_test.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = accessibility_bridge_test.mm; sourceTree = ""; }; 0AC2330B24BA71D300A85907 /* FlutterTextInputPluginTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterTextInputPluginTest.mm; sourceTree = ""; }; - 0AC2330F24BA71D300A85907 /* FlutterBinaryMessengerRelayTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterBinaryMessengerRelayTest.mm; sourceTree = ""; }; 0AC2331024BA71D300A85907 /* connection_collection_test.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = connection_collection_test.mm; sourceTree = ""; }; 0AC2331224BA71D300A85907 /* FlutterEnginePlatformViewTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterEnginePlatformViewTest.mm; sourceTree = ""; }; 0AC2331924BA71D300A85907 /* FlutterPluginAppLifeCycleDelegateTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterPluginAppLifeCycleDelegateTest.mm; sourceTree = ""; }; @@ -72,7 +71,6 @@ 3DD7D38C27D2B81000DA365C /* FlutterUndoManagerPluginTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterUndoManagerPluginTest.mm; sourceTree = ""; }; 689EC1E2281B30D3008FEB58 /* FlutterSpellCheckPluginTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterSpellCheckPluginTest.mm; sourceTree = ""; }; 68B6091227F62F990036AC78 /* VsyncWaiterIosTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = VsyncWaiterIosTest.mm; sourceTree = ""; }; - 73F12C22288F92FF00AFC3A6 /* FlutterViewControllerTest_mrc.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterViewControllerTest_mrc.mm; sourceTree = ""; }; D2D361A52B234EAC0018964E /* FlutterMetalLayerTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterMetalLayerTest.mm; sourceTree = ""; }; F7521D7226BB671E005F15C5 /* libios_test_flutter.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libios_test_flutter.dylib; path = "../../../../out/$(FLUTTER_ENGINE)/libios_test_flutter.dylib"; sourceTree = ""; }; F7521D7526BB673E005F15C5 /* libocmock_shared.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libocmock_shared.dylib; path = "../../../../out/$(FLUTTER_ENGINE)/libocmock_shared.dylib"; sourceTree = ""; }; @@ -109,12 +107,10 @@ 0AC232F724BA71D300A85907 /* FlutterEngineTest.mm */, 0AC2330324BA71D300A85907 /* accessibility_bridge_test.mm */, 0AC2330B24BA71D300A85907 /* FlutterTextInputPluginTest.mm */, - 0AC2330F24BA71D300A85907 /* FlutterBinaryMessengerRelayTest.mm */, 0AC2331024BA71D300A85907 /* connection_collection_test.mm */, 0AC2331224BA71D300A85907 /* FlutterEnginePlatformViewTest.mm */, 0AC2331924BA71D300A85907 /* FlutterPluginAppLifeCycleDelegateTest.mm */, 0AC2332124BA71D300A85907 /* FlutterViewControllerTest.mm */, - 73F12C22288F92FF00AFC3A6 /* FlutterViewControllerTest_mrc.mm */, D2D361A52B234EAC0018964E /* FlutterMetalLayerTest.mm */, ); name = Source; diff --git a/testing/ios/IosUnitTests/Tests/FlutterEngineConfig.xcconfig b/testing/ios/IosUnitTests/Tests/FlutterEngineConfig.xcconfig index f54d553ef4f73..8f5ca977be7a1 100644 --- a/testing/ios/IosUnitTests/Tests/FlutterEngineConfig.xcconfig +++ b/testing/ios/IosUnitTests/Tests/FlutterEngineConfig.xcconfig @@ -1,3 +1,3 @@ FLUTTER_ENGINE[arch=x86_64]=ios_debug_sim_unopt FLUTTER_ENGINE[arch=arm64]=ios_debug_sim_unopt_arm64 -FLUTTER_ENGINE=ios_debug_sim_unopt +FLUTTER_ENGINE=ios_debug_sim_unopt_arm64