Skip to content

Commit

Permalink
Add functional test for Annex I reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Jan 22, 2025
1 parent 8c873c5 commit 7ddd539
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/functional/adapter/DashJsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class DashJsAdapter {
})
}

async waitForMediaSegmentDownload(timeoutValue) {
async waitForMediaSegmentDownload(timeoutValue, mediaType = 'all') {
return new Promise((resolve) => {
let timeout = null;

Expand All @@ -586,7 +586,7 @@ class DashJsAdapter {
_onComplete({});
}
const _onEvent = (e) => {
if (e.request.type === 'MediaSegment') {
if (e.request.type === 'MediaSegment' && (e.request.mediaType === mediaType || mediaType === 'all')) {
_onComplete(e);
}
}
Expand Down
14 changes: 14 additions & 0 deletions test/functional/config/test-configurations/streams/smoke.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@
}
}
},
{
"name": "livesim2 Annex I",
"type": "live",
"url": "https://livesim.dashif.org/livesim2/annexI_dashjs=rocks/testpic_6s/Manifest.mpd?dashjs=rocks",
"includedTestfiles": [
"feature-support/annex-i"
],
"testdata": {
"annexI": {
"mediaTypes": ["video"],
"expectedQueryString": "?dashjs=rocks"
}
}
},
{
"name": "DASH-IF Live Sim - Segment Template without manifest updates",
"type": "live",
Expand Down
1 change: 1 addition & 0 deletions test/functional/src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ TESTCASES.DRM.KEEP_MEDIA_KEY_SESSIONS = TESTCASES.CATEGORIES.DRM + 'keep-media-k
TESTCASES.FEATURE_SUPPORT.EMSG_TRIGGERED = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'emsg-triggered';
TESTCASES.FEATURE_SUPPORT.MPD_PATCHING = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'mpd-patching';
TESTCASES.FEATURE_SUPPORT.CMCD = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'cmcd';
TESTCASES.FEATURE_SUPPORT.ANNEX_I = TESTCASES.CATEGORIES.FEATURE_SUPPORT + 'annex-i';

TESTCASES.LIVE.CATCHUP = TESTCASES.CATEGORIES.LIVE + 'latency-catchup';
TESTCASES.LIVE.DELAY = TESTCASES.CATEGORIES.LIVE + 'live-delay';
Expand Down
57 changes: 57 additions & 0 deletions test/functional/test/feature-support/annex-i.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Constants from '../../src/Constants.js';
import Utils from '../../src/Utils.js';

import {
checkIsPlaying,
checkIsProgressing,
checkNoCriticalErrors,
initializeDashJsAdapter
} from '../common/common.js';
import {expect} from 'chai';

const TESTCASE = Constants.TESTCASES.FEATURE_SUPPORT.ANNEX_I;

Utils.getTestvectorsForTestcase(TESTCASE).forEach((item) => {
const mpd = item.url;

describe(`${TESTCASE} - ${item.name} - ${mpd}`, () => {
let playerAdapter;

before(() => {
if (!item.testdata || !item.testdata.annexI || !item.testdata.annexI.mediaTypes || item.testdata.annexI.mediaTypes.length === 0 || !item.testdata.annexI.expectedQueryString) {
this.skip();
}
playerAdapter = initializeDashJsAdapter(item, mpd);
})

after(() => {
playerAdapter.destroy();
})

it(`Checking playing state`, async () => {
await checkIsPlaying(playerAdapter, true);
})

it(`Checking progressing state`, async () => {
await checkIsProgressing(playerAdapter);
});


it(`Expect requests to have Annex I query parameters`, async () => {
for (const mediaType of item.testdata.annexI.mediaTypes) {
const eventPayload = await playerAdapter.waitForMediaSegmentDownload(Constants.TEST_TIMEOUT_THRESHOLDS.EVENT_WAITING_TIME, mediaType)
expect(eventPayload.request).to.not.be.undefined;
expect(eventPayload.request.url).to.not.be.undefined;
const requestUrl = eventPayload.request.url;
const url = new URL(requestUrl);
const queryParameterString = url.search;
expect(queryParameterString).to.be.equal(item.testdata.annexI.expectedQueryString);
}
})

it(`Expect no critical errors to be thrown`, () => {
checkNoCriticalErrors(playerAdapter);
})

})
})

0 comments on commit 7ddd539

Please sign in to comment.