From c16c115f46afa97f2fd67d974c31173cdaf47d1f Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 29 Jul 2021 13:14:02 -0700 Subject: [PATCH 1/2] Unskip iOS launch URL tests --- .../Source/FlutterAppDelegateTest.mm | 19 ++++++++++++------- .../IosUnitTests.xcodeproj/project.pbxproj | 12 ++++++------ .../xcschemes/IosUnitTests.xcscheme | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm index 9c275da9e955a..d6f92b599fdbc 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm @@ -18,15 +18,16 @@ @interface FlutterAppDelegateTest : XCTestCase @implementation FlutterAppDelegateTest -// TODO(dnfield): https://github.com/flutter/flutter/issues/74267 -- (void)skip_testLaunchUrl { +- (void)testLaunchUrl { FlutterAppDelegate* appDelegate = [[FlutterAppDelegate alloc] init]; FlutterViewController* viewController = OCMClassMock([FlutterViewController class]); FlutterEngine* engine = OCMClassMock([FlutterEngine class]); FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - OCMStub([engine waitForFirstFrame:3.0 callback:([OCMArg invokeBlockWithArgs:@(NO), nil])]); + // Set blockArg to a strong local to retain to end of scope. + id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; @@ -42,14 +43,16 @@ - (void)skip_testLaunchUrl { OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]); } -- (void)skip_testLaunchUrlWithQueryParameterAndFragment { +- (void)testLaunchUrlWithQueryParameterAndFragment { FlutterAppDelegate* appDelegate = [[FlutterAppDelegate alloc] init]; FlutterViewController* viewController = OCMClassMock([FlutterViewController class]); FlutterEngine* engine = OCMClassMock([FlutterEngine class]); FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - OCMStub([engine waitForFirstFrame:3.0 callback:([OCMArg invokeBlockWithArgs:@(NO), nil])]); + // Set blockArg to a strong local to retain to end of scope. + id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; @@ -66,14 +69,16 @@ - (void)skip_testLaunchUrlWithQueryParameterAndFragment { arguments:@"/custom/route?query=test#fragment"]); } -- (void)skip_testLaunchUrlWithFragmentNoQueryParameter { +- (void)testLaunchUrlWithFragmentNoQueryParameter { FlutterAppDelegate* appDelegate = [[FlutterAppDelegate alloc] init]; FlutterViewController* viewController = OCMClassMock([FlutterViewController class]); FlutterEngine* engine = OCMClassMock([FlutterEngine class]); FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - OCMStub([engine waitForFirstFrame:3.0 callback:([OCMArg invokeBlockWithArgs:@(NO), nil])]); + // Set blockArg to a strong local to retain to end of scope. + id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; diff --git a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj index ea69e52363610..ded887aafba81 100644 --- a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj +++ b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj @@ -44,11 +44,11 @@ 0AC232F424BA71D300A85907 /* SemanticsObjectTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SemanticsObjectTest.mm; sourceTree = ""; }; 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.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterTextInputPluginTest.m; 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.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterPluginAppLifeCycleDelegateTest.m; sourceTree = ""; }; + 0AC2331924BA71D300A85907 /* FlutterPluginAppLifeCycleDelegateTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterPluginAppLifeCycleDelegateTest.mm; sourceTree = ""; }; 0AC2332124BA71D300A85907 /* FlutterViewControllerTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FlutterViewControllerTest.mm; sourceTree = ""; }; 0D1CE5D7233430F400E5D880 /* FlutterChannelsTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterChannelsTest.m; sourceTree = ""; }; 0D6AB6B122BB05E100EEE540 /* IosUnitTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IosUnitTests.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -90,11 +90,11 @@ 0AC232F424BA71D300A85907 /* SemanticsObjectTest.mm */, 0AC232F724BA71D300A85907 /* FlutterEngineTest.mm */, 0AC2330324BA71D300A85907 /* accessibility_bridge_test.mm */, - 0AC2330B24BA71D300A85907 /* FlutterTextInputPluginTest.m */, + 0AC2330B24BA71D300A85907 /* FlutterTextInputPluginTest.mm */, 0AC2330F24BA71D300A85907 /* FlutterBinaryMessengerRelayTest.mm */, 0AC2331024BA71D300A85907 /* connection_collection_test.mm */, 0AC2331224BA71D300A85907 /* FlutterEnginePlatformViewTest.mm */, - 0AC2331924BA71D300A85907 /* FlutterPluginAppLifeCycleDelegateTest.m */, + 0AC2331924BA71D300A85907 /* FlutterPluginAppLifeCycleDelegateTest.mm */, 0AC2332124BA71D300A85907 /* FlutterViewControllerTest.mm */, ); name = Source; @@ -209,8 +209,8 @@ 0D6AB6A922BB05E100EEE540 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "Aaron Clarke"; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = "The Flutter Authors"; TargetAttributes = { 0D6AB6B022BB05E100EEE540 = { CreatedOnToolsVersion = 10.2.1; diff --git a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/xcshareddata/xcschemes/IosUnitTests.xcscheme b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/xcshareddata/xcschemes/IosUnitTests.xcscheme index 27c2be6b4bcce..48aa2903c3a41 100644 --- a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/xcshareddata/xcschemes/IosUnitTests.xcscheme +++ b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/xcshareddata/xcschemes/IosUnitTests.xcscheme @@ -1,6 +1,6 @@ Date: Wed, 4 Aug 2021 17:52:02 -0700 Subject: [PATCH 2/2] blockNoInvoker --- .../framework/Source/FlutterAppDelegateTest.mm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm index d6f92b599fdbc..1997d76bc5b2d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm @@ -25,9 +25,9 @@ - (void)testLaunchUrl { FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - // Set blockArg to a strong local to retain to end of scope. - id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; - OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); + // Set blockNoInvoker to a strong local to retain to end of scope. + id blockNoInvoker = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockNoInvoker]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; @@ -50,9 +50,9 @@ - (void)testLaunchUrlWithQueryParameterAndFragment { FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - // Set blockArg to a strong local to retain to end of scope. - id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; - OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); + // Set blockNoInvoker to a strong local to retain to end of scope. + id blockNoInvoker = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockNoInvoker]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; @@ -76,9 +76,9 @@ - (void)testLaunchUrlWithFragmentNoQueryParameter { FlutterMethodChannel* navigationChannel = OCMClassMock([FlutterMethodChannel class]); OCMStub([engine navigationChannel]).andReturn(navigationChannel); OCMStub([viewController engine]).andReturn(engine); - // Set blockArg to a strong local to retain to end of scope. - id blockArg = [OCMArg invokeBlockWithArgs:@NO, nil]; - OCMStub([engine waitForFirstFrame:3.0 callback:blockArg]); + // Set blockNoInvoker to a strong local to retain to end of scope. + id blockNoInvoker = [OCMArg invokeBlockWithArgs:@NO, nil]; + OCMStub([engine waitForFirstFrame:3.0 callback:blockNoInvoker]); appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; };