Skip to content

Commit 71cf910

Browse files
committed
Fix crash in SplashScreenManagerTests
Tests passed locally but testLoadDefaultSplashScreenViewFailsWhenStoryboardNotFound crashed in *some* CI runs with: ``` Test Case '-[ios_test_flutter_swift.SplashScreenManagerTests testLoadDefaultSplashScreenViewFailsWhenStoryboardNotFound]' started. IosUnitTests(19638,0x10b879200) malloc: enabling scribbling to detect mods to free blocks IosUnitTests(19638) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null) IosUnitTests(19638) MallocStackLogging: recording malloc (and VM allocation) stacks using lite mode 2026-04-23 08:57:59.075045-0700 IosUnitTests[19638:136527] [General] Failed to send CA Event for app launch measurements for ca_event_type: 0 event_name: com.apple.app_launch_measurement.FirstFramePresentationMetric 2026-04-23 08:57:59.145240-0700 IosUnitTests[19638:136528] [General] Failed to send CA Event for app launch measurements for ca_event_type: 1 event_name: com.apple.app_launch_measurement.ExtendedLaunchMetrics ``` MockBundle subclassed Bundle, but relied on the default initializer. Bundle is a class cluster and the default initializer really wants a real bundle with a physical directory on disk. The mock overrides the infoDictionary and path(forResource:ofType:) methods, but any other methods will be on some uninitialised garbage version of Bundle. To work around this, I bootstrapped it with the bundle for the tests themselves. We still mock out the two methods we care about for the test, but this should avoid the crash.
1 parent a444181 commit 71cf910

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

engine/src/flutter/shell/platform/darwin/ios/framework/Source/SplashScreenManagerTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ final class MockBundle: Bundle {
1414
var mockInfoDictionary: [String: Any]?
1515
var mockPaths: [String: String] = [:]
1616

17+
override init() {
18+
// Use the path of the test bundle to ensure valid internal state
19+
let testBundle = Bundle(for: MockBundle.self)
20+
super.init(path: testBundle.bundlePath)!
21+
}
22+
1723
override var infoDictionary: [String: Any]? {
1824
return mockInfoDictionary
1925
}

0 commit comments

Comments
 (0)