From a3fd166dc773ef62fa8308064a1811cd2ee57344 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 7 Jun 2022 15:18:26 -0700 Subject: [PATCH] Added plist flag for enabling trace-systrace. --- .../darwin/ios/framework/Source/FlutterDartProject.mm | 6 ++++++ .../ios/framework/Source/FlutterDartProjectTest.mm | 9 +++++++++ testing/ios/IosUnitTests/App/Info.plist | 2 ++ 3 files changed, 17 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 46d1cbae02132..272ddec44fe88 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -167,6 +167,12 @@ settings.enable_impeller = enableImpeller.boolValue; } + NSNumber* enableTraceSystrace = [mainBundle objectForInfoDictionaryKey:@"FLTTraceSystrace"]; + // Change the default only if the option is present. + if (enableTraceSystrace != nil) { + settings.trace_systrace = enableTraceSystrace.boolValue; + } + // Leak Dart VM settings, set whether leave or clean up the VM after the last shell shuts down. NSNumber* leakDartVM = [mainBundle objectForInfoDictionaryKey:@"FLTLeakDartVM"]; // It will change the default leak_vm value in settings only if the key exists. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm index 57d98ea85dd3e..33e7e2a973f6c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm @@ -71,6 +71,15 @@ - (void)testEnableImpellerSettingIsCorrectlyParsed { XCTAssertEqual(settings.enable_impeller, NO); } +- (void)testEnableTraceSystraceSettingIsCorrectlyParsed { + NSBundle* mainBundle = [NSBundle mainBundle]; + NSNumber* enableTraceSystrace = [mainBundle objectForInfoDictionaryKey:@"FLTTraceSystrace"]; + XCTAssertNotNil(enableTraceSystrace); + XCTAssertEqual(enableTraceSystrace.boolValue, NO); + auto settings = FLTDefaultSettingsForBundle(); + XCTAssertEqual(settings.trace_systrace, NO); +} + - (void)testEmptySettingsAreCorrect { XCTAssertFalse([FlutterDartProject allowsArbitraryLoads:[[NSDictionary alloc] init]]); XCTAssertEqualObjects(@"", [FlutterDartProject domainNetworkPolicy:[[NSDictionary alloc] init]]); diff --git a/testing/ios/IosUnitTests/App/Info.plist b/testing/ios/IosUnitTests/App/Info.plist index 73bfcb252cd67..252bc671749da 100644 --- a/testing/ios/IosUnitTests/App/Info.plist +++ b/testing/ios/IosUnitTests/App/Info.plist @@ -48,6 +48,8 @@ FLTEnableImpeller + FLTTraceSystrace + UIRequiredDeviceCapabilities armv7