/
dash.vo.ContentProtection.js
138 lines (131 loc) · 3.91 KB
/
dash.vo.ContentProtection.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import {expect} from 'chai';
import ContentProtection from '../../../../src/dash/vo/ContentProtection.js';
describe('Content Protection', () => {
it('should be constructed with null values', () => {
const contentProtection = new ContentProtection();
expect(contentProtection).to.deep.equal({
schemeIdUri: null,
value: null,
id: null,
ref: null,
refId: null,
robustness: null,
keyId: null,
cencDefaultKid: null,
pssh: null,
pro: null,
laUrl: null,
});
});
it('should initialise with correct base values', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: null,
refId: null,
robustness: null,
keyId: null,
cencDefaultKid: null,
pssh: null,
pro: null,
laUrl: null
});
});
it('should initialise with correct complete values', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
'cenc:default_KID': 'keyId',
pssh: 'pssh',
pro: 'pro',
Laurl: 'laUrl'
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
cencDefaultKid: 'keyId',
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl'
});
});
it('should handle lowercase laurl', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
value: '1',
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
'cenc:default_KID': 'keyId',
pssh: 'pssh',
pro: 'pro',
laurl: 'laUrl'
});
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: '1',
id: null,
ref: 'ref',
refId: 'refId',
robustness: 'robustness',
keyId: null,
cencDefaultKid: 'keyId',
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl'
});
});
it('merge attributes from reference', () => {
const contentProtection = new ContentProtection();
contentProtection.init({
schemeIdUri: 'testScheme',
ref: 'ref',
refId: 'refId',
pssh: 'pssh',
pro: 'pro',
laurl: 'laUrl'
});
contentProtection.mergeAttributesFromReference({
schemeIdUri: 'scheme-new',
value: 'value-new',
id: 'id-new',
robustness: 'robustness-new',
cencDefaultKid: 'keyId-new',
pssh: 'pssh-new',
pro: 'pro-new',
laUrl: 'laUrl-new',
ref: 'ref-new'
})
console.log(contentProtection)
expect(contentProtection).to.deep.equal({
schemeIdUri: 'testScheme',
value: 'value-new',
id: 'id-new',
robustness: 'robustness-new',
cencDefaultKid: 'keyId-new',
keyId: null,
pssh: 'pssh',
pro: 'pro',
laUrl: 'laUrl',
ref: 'ref',
refId: 'refId',
});
});
});