Skip to content

Commit a78ca09

Browse files
committed
MCP: fix integration tests
1 parent 6bcfdb0 commit a78ca09

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

tests/integration/scenarios/mediaCapabilitiesProber/getCompatibleDRM.js renamed to tests/integration/scenarios/mediaCapabilitiesProber/check_drm_configuration.js

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function mockNegativeResultsRMKSA() {
5959
};
6060
}
6161

62-
describe("mediaCapabilitiesProber - getCompatibleDRMConfigurations", () => {
62+
describe("mediaCapabilitiesProber - checkDrmConfiguration", () => {
6363
const mksConfiguration = {
6464
initDataTypes: ["cenc"],
6565
videoCapabilities: [
@@ -82,47 +82,48 @@ describe("mediaCapabilitiesProber - getCompatibleDRMConfigurations", () => {
8282
{ type: "com.microsoft.playready", configuration: mksConfiguration },
8383
];
8484

85-
it("Should support all configurations.", async () => {
85+
it("Should resolve when the given configuration is supported.", async () => {
8686
const resetRMKSA = mockPositivesResultsRMKSA();
87-
const results =
88-
await mediaCapabilitiesProber.getCompatibleDRMConfigurations(keySystems);
89-
90-
expect(results.length).to.be.equal(2);
91-
for (let i = 0; i < results.length; i++) {
92-
expect(results[i].configuration).not.to.be.undefined;
93-
expect(results[i].type).not.to.be.undefined;
94-
expect(results[i].compatibleConfiguration).not.to.be.undefined;
95-
}
87+
const results1 = await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[0]);
88+
expect(results1).not.to.be.undefined;
89+
const results2 = await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[1]);
90+
expect(results2).not.to.be.undefined;
9691
resetRMKSA();
9792
});
9893

99-
it("Should support half of configurations only.", async () => {
94+
it("Should reject when configurations are not supported yet resolve when some are.", async () => {
10095
const resetRMKSA = mockMixedResultsRMKSA();
101-
const results =
102-
await mediaCapabilitiesProber.getCompatibleDRMConfigurations(keySystems);
103-
104-
expect(results.length).to.be.equal(2);
105-
expect(results[0].configuration).not.to.be.undefined;
106-
expect(results[0].type).not.to.be.undefined;
107-
expect(results[0].compatibleConfiguration).to.be.undefined;
108-
expect(results[1].configuration).not.to.be.undefined;
109-
expect(results[1].type).not.to.be.undefined;
110-
expect(results[1].compatibleConfiguration).not.to.be.undefined;
96+
await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[0]).then(
97+
() => {
98+
throw new Error("Should not have resolved");
99+
},
100+
(err) => {
101+
expect(err).toBeInstanceOf(Error);
102+
},
103+
);
104+
const results2 = await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[1]);
105+
expect(results2).not.to.be.undefined;
111106
resetRMKSA();
112107
});
113108

114-
it("Should not support configurations.", async () => {
109+
it("Should reject when no configuration is supported", async () => {
115110
const resetRMKSA = mockNegativeResultsRMKSA();
116-
const results =
117-
await mediaCapabilitiesProber.getCompatibleDRMConfigurations(keySystems);
118-
119-
expect(results.length).to.be.equal(2);
120-
expect(results[0].configuration).not.to.be.undefined;
121-
expect(results[0].type).not.to.be.undefined;
122-
expect(results[0].compatibleConfiguration).to.be.undefined;
123-
expect(results[1].configuration).not.to.be.undefined;
124-
expect(results[1].type).not.to.be.undefined;
125-
expect(results[1].compatibleConfiguration).to.be.undefined;
111+
await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[0]).then(
112+
() => {
113+
throw new Error("Should not have resolved");
114+
},
115+
(err) => {
116+
expect(err).toBeInstanceOf(Error);
117+
},
118+
);
119+
await mediaCapabilitiesProber.checkDrmConfiguration(keySystems[1]).then(
120+
() => {
121+
throw new Error("Should not have resolved");
122+
},
123+
(err) => {
124+
expect(err).toBeInstanceOf(Error);
125+
},
126+
);
126127
resetRMKSA();
127128
});
128129
});

0 commit comments

Comments
 (0)