fix(ios): drop RunnerTests coverage of the removed Atmos raw EC3 loader
RawEc3Loader and its ProbeURLProtocol harness were deleted with the Atmos output diagnostics, but the iOS RunnerTests kept exercising them, so the Apple native reliability job no longer compiled.
This commit is contained in:
@@ -101,46 +101,6 @@ final class ReleaseTrackingCore: MpvPlayerCoreBase {
|
||||
deinit { onDeinit() }
|
||||
}
|
||||
|
||||
final class ProbeURLProtocol: URLProtocol {
|
||||
private static let lock = NSLock()
|
||||
private static var startHandler: ((ProbeURLProtocol) -> Void)?
|
||||
private static var stopHandler: (() -> Void)?
|
||||
|
||||
static func configure(
|
||||
start: @escaping (ProbeURLProtocol) -> Void,
|
||||
stop: (() -> Void)? = nil
|
||||
) {
|
||||
lock.lock()
|
||||
startHandler = start
|
||||
stopHandler = stop
|
||||
lock.unlock()
|
||||
}
|
||||
|
||||
static func reset() {
|
||||
lock.lock()
|
||||
startHandler = nil
|
||||
stopHandler = nil
|
||||
lock.unlock()
|
||||
}
|
||||
|
||||
override class func canInit(with request: URLRequest) -> Bool { true }
|
||||
override class func canonicalRequest(for request: URLRequest) -> URLRequest { request }
|
||||
|
||||
override func startLoading() {
|
||||
Self.lock.lock()
|
||||
let handler = Self.startHandler
|
||||
Self.lock.unlock()
|
||||
handler?(self)
|
||||
}
|
||||
|
||||
override func stopLoading() {
|
||||
Self.lock.lock()
|
||||
let handler = Self.stopHandler
|
||||
Self.lock.unlock()
|
||||
handler?()
|
||||
}
|
||||
}
|
||||
|
||||
final class MpvPlayerContractTests: XCTestCase {
|
||||
private let failure = NSError(
|
||||
domain: "MpvPlayerContractTests",
|
||||
@@ -480,100 +440,6 @@ final class MpvPlayerContractTests: XCTestCase {
|
||||
XCTAssertFalse(core.validateSideDataDimensions(width: 16_384, height: 16_384))
|
||||
}
|
||||
|
||||
func testRawEc3LoaderBoundsAndIgnoresLateCallbacksForBothModes() {
|
||||
for finiteLength in [false, true] {
|
||||
let loader = RawEc3Loader(
|
||||
source: URL(string: "https://example.invalid/test.ec3")!,
|
||||
finiteLength: finiteLength,
|
||||
maximumBufferedBytes: 8,
|
||||
sessionConfiguration: .ephemeral
|
||||
)
|
||||
let session = URLSession(configuration: .ephemeral)
|
||||
let task = session.dataTask(with: URL(string: "https://example.invalid/test.ec3")!)
|
||||
|
||||
loader.urlSession(session, dataTask: task, didReceive: Data([1, 2, 3, 4]))
|
||||
var snapshot = loader.statusSnapshot()
|
||||
XCTAssertEqual(snapshot.bytesReceived, 4)
|
||||
XCTAssertEqual(snapshot.retainedBytes, 4)
|
||||
XCTAssertNil(snapshot.errorCode)
|
||||
|
||||
loader.urlSession(session, dataTask: task, didReceive: Data([5, 6, 7, 8, 9]))
|
||||
snapshot = loader.statusSnapshot()
|
||||
XCTAssertEqual(snapshot.bytesReceived, 4)
|
||||
XCTAssertEqual(snapshot.retainedBytes, 0)
|
||||
XCTAssertEqual(snapshot.errorCode, "response_too_large")
|
||||
|
||||
loader.urlSession(session, dataTask: task, didReceive: Data([10]))
|
||||
let lateSnapshot = loader.statusSnapshot()
|
||||
XCTAssertEqual(lateSnapshot.bytesReceived, snapshot.bytesReceived)
|
||||
XCTAssertEqual(lateSnapshot.retainedBytes, 0)
|
||||
loader.cancel()
|
||||
loader.cancel()
|
||||
XCTAssertEqual(loader.statusSnapshot().pendingRequestCount, 0)
|
||||
let cancelledLoader = RawEc3Loader(
|
||||
source: URL(string: "https://example.invalid/cancel.ec3")!,
|
||||
finiteLength: finiteLength,
|
||||
maximumBufferedBytes: 8,
|
||||
sessionConfiguration: .ephemeral
|
||||
)
|
||||
cancelledLoader.urlSession(session, dataTask: task, didReceive: Data([1, 2, 3, 4]))
|
||||
XCTAssertEqual(cancelledLoader.statusSnapshot().retainedBytes, 4)
|
||||
cancelledLoader.cancel()
|
||||
cancelledLoader.cancel()
|
||||
let cancelledSnapshot = cancelledLoader.statusSnapshot()
|
||||
XCTAssertEqual(cancelledSnapshot.retainedBytes, 0)
|
||||
XCTAssertEqual(cancelledSnapshot.pendingRequestCount, 0)
|
||||
session.invalidateAndCancel()
|
||||
}
|
||||
}
|
||||
|
||||
func testRawEc3LoaderCompletesThroughInjectedURLProtocolForBothModes() {
|
||||
defer { ProbeURLProtocol.reset() }
|
||||
for finiteLength in [false, true] {
|
||||
let requestStarted = expectation(description: "probe request started")
|
||||
let loaderFinished = expectation(description: "probe loader finished")
|
||||
ProbeURLProtocol.configure { protocolInstance in
|
||||
let response = URLResponse(
|
||||
url: protocolInstance.request.url!,
|
||||
mimeType: "audio/eac3",
|
||||
expectedContentLength: -1,
|
||||
textEncodingName: nil
|
||||
)
|
||||
protocolInstance.client?.urlProtocol(
|
||||
protocolInstance,
|
||||
didReceive: response,
|
||||
cacheStoragePolicy: .notAllowed
|
||||
)
|
||||
protocolInstance.client?.urlProtocol(protocolInstance, didLoad: Data([1, 2, 3, 4]))
|
||||
protocolInstance.client?.urlProtocolDidFinishLoading(protocolInstance)
|
||||
requestStarted.fulfill()
|
||||
}
|
||||
|
||||
let configuration = URLSessionConfiguration.ephemeral
|
||||
configuration.protocolClasses = [ProbeURLProtocol.self]
|
||||
let loader = RawEc3Loader(
|
||||
source: URL(string: "https://probe.test/audio.ec3")!,
|
||||
finiteLength: finiteLength,
|
||||
maximumBufferedBytes: 8,
|
||||
sessionConfiguration: configuration,
|
||||
terminalHandlerForTesting: { loaderFinished.fulfill() }
|
||||
)
|
||||
loader.begin()
|
||||
wait(for: [requestStarted, loaderFinished], timeout: 2)
|
||||
|
||||
let snapshot = loader.statusSnapshot()
|
||||
XCTAssertTrue(snapshot.isFinished)
|
||||
XCTAssertEqual(snapshot.bytesReceived, 4)
|
||||
XCTAssertEqual(snapshot.retainedBytes, 4)
|
||||
XCTAssertNil(snapshot.errorCode)
|
||||
|
||||
loader.cancel()
|
||||
let cancelled = loader.statusSnapshot()
|
||||
XCTAssertEqual(cancelled.retainedBytes, 0)
|
||||
XCTAssertEqual(cancelled.pendingRequestCount, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func testPipStartWaitsForDelegateAndCompletesOnce() {
|
||||
let fake = FakePictureInPictureController()
|
||||
fake.isPictureInPicturePossible = true
|
||||
|
||||
Reference in New Issue
Block a user