-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrectly received tracker property updates (#770)
Co-authored-by: Walid Kayhal <[email protected]>
- Loading branch information
Showing
12 changed files
with
193 additions
and
146 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
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
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
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
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
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
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
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
72 changes: 72 additions & 0 deletions
72
Tests/PlayerTests/Tracking/PlayerItemTrackerLifeCycleTests.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,72 @@ | ||
// | ||
// Copyright (c) SRG SSR. All rights reserved. | ||
// | ||
// License information is available from the LICENSE file. | ||
// | ||
|
||
@testable import PillarboxPlayer | ||
|
||
import Foundation | ||
import PillarboxCircumspect | ||
import PillarboxStreams | ||
|
||
final class PlayerItemTrackerLifeCycleTests: TestCase { | ||
func testPlayerItemLifeCycle() { | ||
let publisher = TrackerLifeCycleMock.StatePublisher() | ||
expectAtLeastEqualPublished(values: [.initialized, .deinitialized], from: publisher) { | ||
_ = PlayerItem.simple( | ||
url: Stream.shortOnDemand.url, | ||
trackerAdapters: [TrackerLifeCycleMock.adapter(statePublisher: publisher)] | ||
) | ||
} | ||
} | ||
|
||
func testItemPlayback() { | ||
let player = Player() | ||
let publisher = TrackerLifeCycleMock.StatePublisher() | ||
expectEqualPublished(values: [.initialized, .enabled], from: publisher, during: .seconds(2)) { | ||
player.append(.simple( | ||
url: Stream.onDemand.url, | ||
trackerAdapters: [TrackerLifeCycleMock.adapter(statePublisher: publisher)] | ||
)) | ||
player.play() | ||
} | ||
} | ||
|
||
func testItemEntirePlayback() { | ||
let player = Player() | ||
let publisher = TrackerLifeCycleMock.StatePublisher() | ||
expectAtLeastEqualPublished(values: [.initialized, .enabled, .disabled], from: publisher) { | ||
player.append(.simple( | ||
url: Stream.shortOnDemand.url, | ||
trackerAdapters: [TrackerLifeCycleMock.adapter(statePublisher: publisher)] | ||
)) | ||
player.play() | ||
} | ||
} | ||
|
||
func testNetworkLoadedItemEntirePlayback() { | ||
let player = Player() | ||
let publisher = TrackerLifeCycleMock.StatePublisher() | ||
expectAtLeastEqualPublished(values: [.initialized, .enabled, .disabled], from: publisher) { | ||
player.append(.mock( | ||
url: Stream.shortOnDemand.url, | ||
loadedAfter: 1, | ||
trackerAdapters: [TrackerLifeCycleMock.adapter(statePublisher: publisher)] | ||
)) | ||
player.play() | ||
} | ||
} | ||
|
||
func testFailedItem() { | ||
let player = Player() | ||
let publisher = TrackerLifeCycleMock.StatePublisher() | ||
expectEqualPublished(values: [.initialized, .enabled], from: publisher, during: .milliseconds(500)) { | ||
player.append(.simple( | ||
url: Stream.unavailable.url, | ||
trackerAdapters: [TrackerLifeCycleMock.adapter(statePublisher: publisher)] | ||
)) | ||
player.play() | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.