fune/testing/web-platform/tests/webrtc/RTCRtpCapabilities-helper.js
James Graham 2dc7a68af1 Bug 1386604 - Update web-platform-tests to revision 8b5316ad93c6c1238eea26a3d8052e32b34bbabd, a=testonly
MozReview-Commit-ID: 3HXcvTYpAkA


--HG--
rename : testing/web-platform/tests/fonts/matching/README.md => testing/web-platform/tests/css-fonts/matching/README.md
rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight-ref.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight-ref.html
rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight.html
rename : testing/web-platform/tests/fonts/matching/font-matching.css => testing/web-platform/tests/css-fonts/matching/font-matching.css
rename : testing/web-platform/tests/fonts/matching/resources/variabletest_matching.ttf => testing/web-platform/tests/css-fonts/matching/resources/variabletest_matching.ttf
rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance-ref.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance-ref.html
rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance.html
rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction-ref.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction-ref.html
rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction.html
rename : testing/web-platform/tests/payment-request/OWNERS => testing/web-platform/tests/payment-method-id/OWNERS
rename : testing/web-platform/tests/storage/interfaces.worker.js => testing/web-platform/tests/storage/interfaces.https.worker.js
rename : testing/web-platform/tests/tools/browserutils/requirements.txt => testing/web-platform/tests/tools/wpt/requirements.txt
rename : testing/web-platform/tests/tools/browserutils/utils.py => testing/web-platform/tests/tools/wpt/utils.py
rename : testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait.js => testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait_marionette.js
rename : testing/web-platform/tests/uievents/keyboard/key-manual.css => testing/web-platform/tests/uievents/keyboard/key.css
rename : testing/web-platform/tests/uievents/keyboard/key-manual.js => testing/web-platform/tests/uievents/keyboard/key.js
2017-08-03 11:31:54 +01:00

52 lines
1.5 KiB
JavaScript

'use strict'
// Test is based on the following editor draft:
// https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
// This file depends on dictionary-helper.js which should
// be loaded from the main HTML file.
/*
5.2. RTCRtpSender Interface
dictionary RTCRtpCapabilities {
sequence<RTCRtpCodecCapability> codecs;
sequence<RTCRtpHeaderExtensionCapability> headerExtensions;
};
dictionary RTCRtpCodecCapability {
DOMString mimeType;
unsigned long clockRate;
unsigned short channels;
DOMString sdpFmtpLine;
};
dictionary RTCRtpHeaderExtensionCapability {
DOMString uri;
};
*/
function validateRtpCapabilities(capabilities) {
assert_array_field(capabilities, 'codecs');
for(const codec of capabilities.codecs) {
validateCodecCapability(codec);
}
assert_greater_than(capabilities.codec, 0,
'Expect at least one codec capability available');
assert_array_field(capabilities, 'headerExtensions');
for(const headerExt of capabilities.headerExtensions) {
validateHeaderExtensionCapability(headerExt);
}
}
function validateCodecCapability(codec) {
assert_optional_string_field(codec, 'mimeType');
assert_optional_unsigned_int_field(codec, 'clockRate');
assert_optional_unsigned_int_field(codec, 'channels');
assert_optional_string_field(codec, 'sdpFmtpLine');
}
function validateHeaderExtensionCapability(headerExt) {
assert_optional_string_field(uri);
}