Skip to content

Commit

Permalink
test: Add test case for exclude TIMEOUT errors when disabling streams (
Browse files Browse the repository at this point in the history
…#7387)

Relates to #7368, #7369
  • Loading branch information
zangue authored and avelad committed Oct 18, 2024
1 parent 69316f1 commit 07504db
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/media/streaming_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,41 @@ describe('StreamingEngine', () => {
expect(onError).toHaveBeenCalled();
});

it('never tries to recover from shaka.util.Error.Code.TIMEOUT',
async () => {
setupVod();

const targetUri = '0_video_0';
failRequestsForTarget(
netEngine, targetUri, shaka.util.Error.Code.TIMEOUT);

mediaSourceEngine = new shaka.test.FakeMediaSourceEngine(segmentData);
const config =
shaka.util.PlayerConfiguration.createDefault().streaming;
config.maxDisabledTime = 2;
createStreamingEngine(config);

spyOn(streamingEngine, 'makeAbortDecision_').and.callFake(() => {
return Promise.resolve();
});
// Silence error
onError.and.callFake(() => {});

// Here we go!
streamingEngine.switchVariant(variant);
streamingEngine.switchTextStream(textStream);
await streamingEngine.start();
playing = true;

await runTest();
expect(disableStream).not.toHaveBeenCalled();
expect(onError).toHaveBeenCalledOnceWith(jasmine.objectContaining({
severity: shaka.util.Error.Severity.CRITICAL,
category: shaka.util.Error.Category.NETWORK,
code: shaka.util.Error.Code.TIMEOUT,
}));
});

it('throws recoverable error if try to disable stream succeeded',
async () => {
setupVod();
Expand Down
4 changes: 4 additions & 0 deletions test/test/externs/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ jasmine.Matchers.prototype.toHaveBeenCalled = function(value) {};
jasmine.Matchers.prototype.toHaveBeenCalledWith = function(varArgs) {};


/** @param {...*} varArgs */
jasmine.Matchers.prototype.toHaveBeenCalledOnceWith = function(varArgs) {};


/** @param {number} times */
jasmine.Matchers.prototype.toHaveBeenCalledTimes = function(times) {};

Expand Down

0 comments on commit 07504db

Please sign in to comment.