-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
307 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// TestMonitor.swift | ||
// | ||
|
||
import AVKit | ||
import Foundation | ||
import XCTest | ||
|
||
@testable import MuxPlayerSwift | ||
|
||
class TestMonitor: Monitor { | ||
var monitoringRegistrations: [(MonitoringOptions, Bool)] = [] | ||
|
||
override func setupMonitoring( | ||
playerViewController: AVPlayerViewController, | ||
playbackID: String, | ||
options: MonitoringOptions, | ||
usingDRM: Bool = false | ||
) { | ||
super.setupMonitoring( | ||
playerViewController: playerViewController, | ||
playbackID: playbackID, | ||
options: options, | ||
usingDRM: usingDRM | ||
) | ||
|
||
monitoringRegistrations.append( | ||
(options, usingDRM) | ||
) | ||
} | ||
|
||
override func setupMonitoring( | ||
playerLayer: AVPlayerLayer, | ||
playbackID: String, | ||
options: MonitoringOptions, | ||
usingDRM: Bool = false | ||
) { | ||
super.setupMonitoring( | ||
playerLayer: playerLayer, | ||
playbackID: playbackID, | ||
options: options, | ||
usingDRM: usingDRM | ||
) | ||
|
||
monitoringRegistrations.append( | ||
(options, usingDRM) | ||
) | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
Tests/MuxPlayerSwift/Helpers/TestPlayerObservationContext.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// TestPlayerObservationContext.swift | ||
// | ||
|
||
import Foundation | ||
|
||
import MUXSDKStats | ||
|
||
@testable import MuxPlayerSwift | ||
|
||
class TestPlayerObservationContext: PlayerObservationContext { | ||
|
||
struct MonitorCall { | ||
// AVPlayerViewController or AVPlayerLayer or AVPlayer | ||
// Only included to validate pointer equality, for | ||
// which NSObject suffices | ||
let player: NSObject | ||
let playerName: String | ||
let customerData: MUXSDKCustomerData | ||
let automaticErrorTracking: Bool | ||
} | ||
|
||
var monitorCalls: [MonitorCall] = [] | ||
|
||
override func monitorAVPlayerViewController( | ||
_ player: AVPlayerViewController, | ||
withPlayerName name: String, | ||
customerData: MUXSDKCustomerData, | ||
automaticErrorTracking: Bool | ||
) -> MUXSDKPlayerBinding? { | ||
|
||
monitorCalls.append( | ||
MonitorCall( | ||
player: player, | ||
playerName: name, | ||
customerData: customerData, | ||
automaticErrorTracking: automaticErrorTracking | ||
) | ||
) | ||
|
||
// In its current state this test class is only | ||
// useful for validating Mux Data inputs. | ||
// | ||
// This needs to return a non-nil value in order to | ||
// validate side effects in this SDK. | ||
return nil | ||
} | ||
|
||
override func monitorAVPlayerLayer( | ||
_ player: AVPlayerLayer, | ||
withPlayerName name: String, | ||
customerData: MUXSDKCustomerData, | ||
automaticErrorTracking: Bool | ||
) -> MUXSDKPlayerBinding? { | ||
|
||
monitorCalls.append( | ||
MonitorCall( | ||
player: player, | ||
playerName: name, | ||
customerData: customerData, | ||
automaticErrorTracking: automaticErrorTracking | ||
) | ||
) | ||
|
||
// In its current state this test class is only | ||
// useful for validating Mux Data inputs. | ||
// | ||
// This needs to return a non-nil value in order to | ||
// validate side effects in this SDK. | ||
return nil | ||
} | ||
|
||
override func destroyPlayer( | ||
_ name: String | ||
) { | ||
|
||
} | ||
} |
Oops, something went wrong.