Skip to content

Commit

Permalink
test: Fix fake StreamingEngine persisting active streams between loads
Browse files Browse the repository at this point in the history
Player unit tests use a fake StreamingEngine that persists between
loads.  Some tests then load() multiple times, which causes calls to
destroy() on the fake.

But the fake StreamingEngine was not releasing its active stream
references on destroy(), leading to a brittle test that broke when
PR shaka-project#3459 was introduced.

This fixes the fake to release active streams between loads().

Change-Id: Ifea5234863aeb976ddc45c825ef79342a176bc2f
  • Loading branch information
joeyparrish committed Jul 10, 2021
1 parent 097c9a1 commit 2c26321
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/test/util/simple_fakes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ shaka.test.FakeAbrManager = class {
/** @extends {shaka.media.StreamingEngine} */
shaka.test.FakeStreamingEngine = class {
constructor() {
const resolve = () => Promise.resolve();

let activeVariant = null;
let activeText = null;

/** @type {!jasmine.Spy} */
this.destroy = jasmine.createSpy('destroy').and.callFake(resolve);
this.destroy = jasmine.createSpy('destroy').and.callFake(() => {
activeVariant = null;
activeText = null;
return Promise.resolve();
});

/** @type {!jasmine.Spy} */
this.configure = jasmine.createSpy('configure');
Expand Down

0 comments on commit 2c26321

Please sign in to comment.