Skip to content

Commit

Permalink
Added flag to disable the dart profiler on iOS (flutter#33907)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke authored Jun 8, 2022
1 parent 3507338 commit a205adc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
settings.trace_systrace = enableTraceSystrace.boolValue;
}

NSNumber* enableDartProfiling = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
// Change the default only if the option is present.
if (enableDartProfiling != nil) {
settings.enable_dart_profiling = enableDartProfiling.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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ - (void)testEnableTraceSystraceSettingIsCorrectlyParsed {
XCTAssertEqual(settings.trace_systrace, NO);
}

- (void)testEnableDartProflingSettingIsCorrectlyParsed {
NSBundle* mainBundle = [NSBundle mainBundle];
NSNumber* enableTraceSystrace = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
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]]);
Expand Down
2 changes: 2 additions & 0 deletions testing/ios/IosUnitTests/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<false/>
<key>FLTTraceSystrace</key>
<false/>
<key>FLTEnableDartProfiling</key>
<false/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down

0 comments on commit a205adc

Please sign in to comment.