/
fake_text_displayer.js
63 lines (55 loc) · 1.47 KB
/
fake_text_displayer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @implements {shaka.extern.TextDisplayer}
* @final
*/
shaka.test.FakeTextDisplayer = class {
constructor() {
let isVisible = false;
/** @type {!jasmine.Spy} */
this.destroySpy = jasmine.createSpy('destroy');
/** @type {!jasmine.Spy} */
this.appendSpy = jasmine.createSpy('append');
/** @type {!jasmine.Spy} */
this.removeSpy = jasmine.createSpy('remove');
/** @type {!jasmine.Spy} */
this.isTextVisibleSpy =
jasmine.createSpy('isTextVisible').and.callFake(() => isVisible);
/** @type {!jasmine.Spy} */
this.setTextVisibilitySpy =
jasmine.createSpy('setTextVisibility').and.callFake((on) => {
isVisible = on;
});
}
/** @override */
destroy() {
const func = shaka.test.Util.spyFunc(this.destroySpy);
return func();
}
/** @override */
configure(config) {}
/** @override */
append(cues) {
const func = shaka.test.Util.spyFunc(this.appendSpy);
return func(cues);
}
/** @override */
remove(startTime, endTime) {
const func = shaka.test.Util.spyFunc(this.removeSpy);
return func(startTime, endTime);
}
/** @override */
isTextVisible() {
const func = shaka.test.Util.spyFunc(this.isTextVisibleSpy);
return func();
}
/** @override */
setTextVisibility(on) {
const func = shaka.test.Util.spyFunc(this.setTextVisibilitySpy);
return func(on);
}
};