How to use assert_string_field method in wpt

Best JavaScript code snippet using wpt

RTCStats-helper.js

Source:RTCStats-helper.js Github

copy

Full Screen

...99// and have the type field value same as expected type100// It doesn't validate the other fields of the linked stats101// as validateStatsReport already does all validations102function validateIdField(statsReport, stats, field, type) {103 assert_string_field(stats, field);104 const linkedStats = getStatsById(statsReport, stats[field]);105 assert_equals(linkedStats.type, type,106 `Expect linked stats object to have type ${type}`);107}108function validateOptionalIdField(statsReport, stats, field, type) {109 if(stats[field] !== undefined) {110 validateIdField(statsReport, stats, field, type);111 }112}113/*114 [webrtc-pc]115 8.4. RTCStats Dictionary116 dictionary RTCStats {117 required DOMHighResTimeStamp timestamp;118 required RTCStatsType type;119 required DOMString id;120 };121 */122function validateRtcStats(statsReport, stats) {123 assert_number_field(stats, 'timestamp');124 assert_string_field(stats, 'type');125 assert_string_field(stats, 'id');126}127/*128 [webrtc-stats]129 7.1. RTCRTPStreamStats dictionary130 dictionary RTCRTPStreamStats : RTCStats {131 unsigned long ssrc;132 DOMString mediaType;133 DOMString trackId;134 DOMString transportId;135 DOMString codecId;136 unsigned long firCount;137 unsigned long pliCount;138 unsigned long nackCount;139 unsigned long sliCount;140 unsigned long long qpSum;141 };142 mediaType of type DOMString143 Either "audio" or "video".144 [webrtc-pc]145 8.6. Mandatory To Implement Stats146 - RTCRTPStreamStats, with attributes ssrc, mediaType, trackId,147 transportId, codecId, nackCount148 */149function validateRtpStreamStats(statsReport, stats) {150 validateRtcStats(statsReport, stats);151 assert_unsigned_int_field(stats, 'ssrc');152 assert_string_field(stats, 'mediaType');153 assert_enum_field(stats, 'mediaType', ['audio', 'video'])154 validateIdField(statsReport, stats, 'trackId', 'track');155 validateIdField(statsReport, stats, 'transportId', 'transport');156 validateIdField(statsReport, stats, 'codecId', 'codec');157 assert_optional_unsigned_int_field(stats, 'firCount');158 assert_optional_unsigned_int_field(stats, 'pliCount');159 assert_unsigned_int_field(stats, 'nackCount');160 assert_optional_unsigned_int_field(stats, 'sliCount');161 assert_optional_unsigned_int_field(stats, 'qpSum');162}163/*164 [webrtc-stats]165 7.2. RTCCodecStats dictionary166 dictionary RTCCodecStats : RTCStats {167 unsigned long payloadType;168 RTCCodecType codecType;169 DOMString transportId;170 DOMString mimeType;171 unsigned long clockRate;172 unsigned long channels;173 DOMString sdpFmtpLine;174 DOMString implementation;175 };176 enum RTCCodecType {177 "encode",178 "decode",179 };180 [webrtc-pc]181 8.6. Mandatory To Implement Stats182 - RTCCodecStats, with attributes payloadType, codec, clockRate, channels, sdpFmtpLine183 */184function validateCodecStats(statsReport, stats) {185 validateRtcStats(statsReport, stats);186 assert_unsigned_int_field(stats, 'payloadType');187 assert_enum_field(stats, 'codecType', ['encode', 'decode']);188 validateOptionalIdField(statsReport, stats, 'transportId', 'transport');189 assert_optional_string_field(stats, 'mimeType');190 assert_unsigned_int_field(stats, 'clockRate');191 assert_unsigned_int_field(stats, 'channels');192 assert_string_field(stats, 'sdpFmtpLine');193 assert_optional_string_field(stats, 'implementation');194}195/*196 [webrtc-stats]197 7.3. RTCReceivedRTPStreamStats dictionary198 dictionary RTCReceivedRTPStreamStats : RTCRTPStreamStats {199 unsigned long packetsReceived;200 unsigned long long bytesReceived;201 long packetsLost;202 double jitter;203 double fractionLost;204 unsigned long packetsDiscarded;205 unsigned long packetsFailedDecryption;206 unsigned long packetsRepaired;207 unsigned long burstPacketsLost;208 unsigned long burstPacketsDiscarded;209 unsigned long burstLossCount;210 unsigned long burstDiscardCount;211 double burstLossRate;212 double burstDiscardRate;213 double gapLossRate;214 double gapDiscardRate;215 };216 [webrtc-pc]217 8.6. Mandatory To Implement Stats218 - RTCReceivedRTPStreamStats, with all required attributes from its219 inherited dictionaries, and also attributes packetsReceived,220 bytesReceived, packetsLost, jitter, packetsDiscarded221 */222function validateReceivedRtpStreamStats(statsReport, stats) {223 validateRtpStreamStats(statsReport, stats);224 assert_unsigned_int_field(stats, 'packetsReceived');225 assert_unsigned_int_field(stats, 'bytesReceived');226 assert_unsigned_int_field(stats, 'packetsLost');227 assert_number_field(stats, 'jitter');228 assert_optional_number_field(stats, 'fractionLost');229 assert_unsigned_int_field(stats, 'packetsDiscarded');230 assert_optional_unsigned_int_field(stats, 'packetsFailedDecryption');231 assert_optional_unsigned_int_field(stats, 'packetsRepaired');232 assert_optional_unsigned_int_field(stats, 'burstPacketsLost');233 assert_optional_unsigned_int_field(stats, 'burstPacketsDiscarded');234 assert_optional_unsigned_int_field(stats, 'burstLossCount');235 assert_optional_unsigned_int_field(stats, 'burstDiscardCount');236 assert_optional_number_field(stats, 'burstLossRate');237 assert_optional_number_field(stats, 'burstDiscardRate');238 assert_optional_number_field(stats, 'gapLossRate');239 assert_optional_number_field(stats, 'gapDiscardRate');240}241/*242 [webrtc-stats]243 7.4. RTCInboundRTPStreamStats dictionary244 dictionary RTCInboundRTPStreamStats : RTCReceivedRTPStreamStats {245 DOMString remoteId;246 unsigned long framesDecoded;247 DOMHighResTimeStamp lastPacketReceivedTimestamp;248 };249 [webrtc-pc]250 8.6. Mandatory To Implement Stats251 - RTCInboundRTPStreamStats, with all required attributes from its inherited252 dictionaries, and also attributes remoteId, framesDecoded253 */254function validateInboundRtpStreamStats(statsReport, stats) {255 validateReceivedRtpStreamStats(statsReport, stats);256 validateIdField(statsReport, stats, 'remoteId', 'remote-outbound-rtp');257 assert_unsigned_int_field(stats, 'framesDecoded');258 assert_optional_number_field(stats, 'lastPacketReceivedTimeStamp');259}260/*261 [webrtc-stats]262 7.5. RTCRemoteInboundRTPStreamStats dictionary263 dictionary RTCRemoteInboundRTPStreamStats : RTCReceivedRTPStreamStats {264 DOMString localId;265 double roundTripTime;266 };267 [webrtc-pc]268 8.6. Mandatory To Implement Stats269 - RTCRemoteInboundRTPStreamStats, with all required attributes from its270 inherited dictionaries, and also attributes localId, roundTripTime271 */272function validateRemoteInboundRtpStreamStats(statsReport, stats) {273 validateReceivedRtpStreamStats(statsReport, stats);274 validateIdField(statsReport, stats, 'localId', 'outbound-rtp');275 assert_number_field(stats, 'roundTripTime');276}277/*278 [webrtc-stats]279 7.6. RTCSentRTPStreamStats dictionary280 dictionary RTCSentRTPStreamStats : RTCRTPStreamStats {281 unsigned long packetsSent;282 unsigned long packetsDiscardedOnSend;283 unsigned long long bytesSent;284 unsigned long long bytesDiscardedOnSend;285 };286 [webrtc-pc]287 8.6. Mandatory To Implement Stats288 - RTCSentRTPStreamStats, with all required attributes from its inherited289 dictionaries, and also attributes packetsSent, bytesSent290 */291function validateSentRtpStreamStats(statsReport, stats) {292 validateRtpStreamStats(statsReport, stats);293 assert_unsigned_int_field(stats, 'packetsSent');294 assert_optional_unsigned_int_field(stats, 'packetsDiscardedOnSend');295 assert_unsigned_int_field(stats, 'bytesSent');296 assert_optional_unsigned_int_field(stats, 'bytesDiscardedOnSend');297}298/*299 [webrtc-stats]300 7.7. RTCOutboundRTPStreamStats dictionary301 dictionary RTCOutboundRTPStreamStats : RTCSentRTPStreamStats {302 DOMString remoteId;303 DOMHighResTimeStamp lastPacketSentTimestamp;304 double targetBitrate;305 unsigned long framesEncoded;306 double totalEncodeTime;307 double averageRTCPInterval;308 };309 [webrtc-pc]310 8.6. Mandatory To Implement Stats311 - RTCOutboundRTPStreamStats, with all required attributes from its312 inherited dictionaries, and also attributes remoteId, framesEncoded313 */314function validateOutboundRtpStreamStats(statsReport, stats) {315 validateSentRtpStreamStats(statsReport, stats)316 validateIdField(statsReport, stats, 'remoteId', 'remote-inbound-rtp');317 assert_optional_number_field(stats, 'lastPacketSentTimestamp');318 assert_optional_number_field(stats, 'targetBitrate');319 assert_unsigned_int_field(stats, 'framesEncoded');320 assert_optional_number_field(stats, 'totalEncodeTime');321 assert_optional_number_field(stats, 'averageRTCPInterval');322}323/*324 [webrtc-stats]325 7.8. RTCRemoteOutboundRTPStreamStats dictionary326 dictionary RTCRemoteOutboundRTPStreamStats : RTCSentRTPStreamStats {327 DOMString localId;328 DOMHighResTimeStamp remoteTimestamp;329 };330 [webrtc-pc]331 8.6. Mandatory To Implement Stats332 - RTCRemoteOutboundRTPStreamStats, with all required attributes from its333 inherited dictionaries, and also attributes localId, remoteTimestamp334 */335function validateRemoteOutboundRtpStreamStats(statsReport, stats) {336 validateSentRtpStreamStats(statsReport, stats);337 validateIdField(statsReport, stats, 'localId', 'inbound-rtp');338 assert_number_field(stats, 'remoteTimeStamp');339}340/*341 [webrtc-stats]342 7.9. RTCRTPContributingSourceStats343 dictionary RTCRTPContributingSourceStats : RTCStats {344 unsigned long contributorSsrc;345 DOMString inboundRtpStreamId;346 unsigned long packetsContributedTo;347 double audioLevel;348 };349 */350function validateContributingSourceStats(statsReport, stats) {351 validateRtcStats(statsReport, stats);352 assert_optional_unsigned_int_field(stats, 'contributorSsrc');353 validateOptionalIdField(statsReport, stats, 'inboundRtpStreamId', 'inbound-rtp');354 assert_optional_unsigned_int_field(stats, 'packetsContributedTo');355 assert_optional_number_field(stats, 'audioLevel');356}357/*358 [webrtc-stats]359 7.10. RTCPeerConnectionStats dictionary360 dictionary RTCPeerConnectionStats : RTCStats {361 unsigned long dataChannelsOpened;362 unsigned long dataChannelsClosed;363 unsigned long dataChannelsRequested;364 unsigned long dataChannelsAccepted;365 };366 [webrtc-pc]367 8.6. Mandatory To Implement Stats368 - RTCPeerConnectionStats, with attributes dataChannelsOpened, dataChannelsClosed369 */370function validatePeerConnectionStats(statsReport, stats) {371 validateRtcStats(statsReport, stats);372 assert_unsigned_int_field(stats, 'dataChannelsOpened');373 assert_unsigned_int_field(stats, 'dataChannelsClosed');374 assert_optional_unsigned_int_field(stats, 'dataChannelsRequested');375 assert_optional_unsigned_int_field(stats, 'dataChannelsAccepted');376}377/*378 [webrtc-stats]379 7.11. RTCMediaStreamStats dictionary380 dictionary RTCMediaStreamStats : RTCStats {381 DOMString streamIdentifier;382 sequence<DOMString> trackIds;383 };384 [webrtc-pc]385 8.6. Mandatory To Implement Stats386 - RTCMediaStreamStats, with attributes streamIdentifer, trackIds387 */388function validateMediaStreamStats(statsReport, stats) {389 validateRtcStats(statsReport, stats);390 assert_string_field(stats, 'streamIdentifier');391 assert_array_field(stats, 'trackIds');392 for(const trackId of stats.trackIds) {393 assert_equals(typeof trackId, 'string',394 'Expect trackId elements to be string');395 assert_true(statsReport.has(trackId),396 `Expect stats report to have stats object with id ${trackId}`);397 const trackStats = statsReport.get(trackId);398 assert_equals(trackStats.type, 'track',399 `Expect track stats object to have type 'track'`);400 }401}402/*403 [webrtc-stats]404 7.12. RTCMediaStreamTrackStats dictionary405 dictionary RTCMediaStreamTrackStats : RTCStats {406 DOMString trackIdentifier;407 boolean remoteSource;408 boolean ended;409 boolean detached;410 DOMString kind;411 DOMHighResTimeStamp estimatedPlayoutTimestamp;412 unsigned long frameWidth;413 unsigned long frameHeight;414 double framesPerSecond;415 unsigned long framesCaptured;416 unsigned long framesSent;417 unsigned long keyFramesSent;418 unsigned long framesReceived;419 unsigned long keyFramesReceived;420 unsigned long framesDecoded;421 unsigned long framesDropped;422 unsigned long framesCorrupted;423 unsigned long partialFramesLost;424 unsigned long fullFramesLost;425 double audioLevel;426 double totalAudioEnergy;427 boolean voiceActivityFlag;428 double echoReturnLoss;429 double echoReturnLossEnhancement;430 unsigned long long totalSamplesSent;431 unsigned long long totalSamplesReceived;432 double totalSamplesDuration;433 unsigned long long concealedSamples;434 unsigned long long concealmentEvents;435 double jitterBufferDelay;436 RTCPriorityType priority;437 };438 [webrtc-pc]439 4.9.1. RTCPriorityType Enum440 enum RTCPriorityType {441 "very-low",442 "low",443 "medium",444 "high"445 };446 8.6. Mandatory To Implement Stats447 - RTCMediaStreamTrackStats, with attributes trackIdentifier, remoteSource,448 ended, detached, frameWidth, frameHeight, framesPerSecond, framesSent,449 framesReceived, framesDecoded, framesDropped, framesCorrupted, audioLevel450 */451function validateMediaStreamTrackStats(statsReport, stats) {452 validateRtcStats(statsReport, stats);453 assert_string_field(stats, 'trackIdentifier');454 assert_boolean_field(stats, 'remoteSource');455 assert_boolean_field(stats, 'ended');456 assert_boolean_field(stats, 'detached');457 assert_optional_enum_field(stats, 'kind', ['audio', 'video']);458 assert_optional_number_field(stats, 'estimatedPlayoutTimestamp');459 assert_unsigned_int_field(stats, 'frameWidth');460 assert_unsigned_int_field(stats, 'frameHeight');461 assert_number_field(stats, 'framesPerSecond');462 assert_optional_unsigned_int_field(stats, 'framesCaptured');463 assert_unsigned_int_field(stats, 'framesSent');464 assert_optional_unsigned_int_field(stats, 'keyFramesSent');465 assert_unsigned_int_field(stats, 'framesReceived');466 assert_optional_unsigned_int_field(stats, 'keyFramesReceived');467 assert_unsigned_int_field(stats, 'framesDecoded');468 assert_unsigned_int_field(stats, 'framesDropped');469 assert_unsigned_int_field(stats, 'framesCorrupted');470 assert_optional_unsigned_int_field(stats, 'partialFramesLost');471 assert_optional_unsigned_int_field(stats, 'fullFramesLost');472 assert_number_field(stats, 'audioLevel');473 assert_optional_number_field(stats, 'totalAudioEnergy');474 assert_optional_boolean_field(stats, 'voiceActivityFlag');475 assert_optional_number_field(stats, 'echoReturnLoss');476 assert_optional_number_field(stats, 'echoReturnLossEnhancement');477 assert_optional_unsigned_int_field(stats, 'totalSamplesSent');478 assert_optional_unsigned_int_field(stats, 'totalSamplesReceived');479 assert_optional_number_field(stats, 'totalSamplesDuration');480 assert_optional_unsigned_int_field(stats, 'concealedSamples');481 assert_optional_unsigned_int_field(stats, 'concealmentEvents');482 assert_optional_number_field(stats, 'jitterBufferDelay');483 assert_optional_enum_field(stats, 'priority',484 ['very-low', 'low', 'medium', 'high']);485}486/*487 [webrtc-stats]488 7.13. RTCDataChannelStats dictionary489 dictionary RTCDataChannelStats : RTCStats {490 DOMString label;491 DOMString protocol;492 long dataChannelIdentifier;493 DOMString transportId;494 RTCDataChannelState state;495 unsigned long messagesSent;496 unsigned long long bytesSent;497 unsigned long messagesReceived;498 unsigned long long bytesReceived;499 };500 [webrtc-pc]501 6.2. RTCDataChannel502 enum RTCDataChannelState {503 "connecting",504 "open",505 "closing",506 "closed"507 };508 8.6. Mandatory To Implement Stats509 - RTCDataChannelStats, with attributes label, protocol, datachannelId, state,510 messagesSent, bytesSent, messagesReceived, bytesReceived511 */512function validateDataChannelStats(statsReport, stats) {513 validateRtcStats(statsReport, stats);514 assert_string_field(stats, 'label');515 assert_string_field(stats, 'protocol');516 assert_int_field(stats, 'dataChannelIdentifier');517 validateOptionalIdField(statsReport, stats, 'transportId', 'transport');518 assert_enum_field(stats, 'state',519 ['connecting', 'open', 'closing', 'closed']);520 assert_unsigned_int_field(stats, 'messagesSent');521 assert_unsigned_int_field(stats, 'bytesSent');522 assert_unsigned_int_field(stats, 'messagesReceived');523 assert_unsigned_int_field(stats, 'bytesReceived');524}525/*526 [webrtc-stats]527 7.14. RTCTransportStats dictionary528 dictionary RTCTransportStats : RTCStats {529 unsigned long packetsSent;530 unsigned long packetsReceived;531 unsigned long long bytesSent;532 unsigned long long bytesReceived;533 DOMString rtcpTransportStatsId;534 RTCIceRole iceRole;535 RTCDtlsTransportState dtlsState;536 DOMString selectedCandidatePairId;537 DOMString localCertificateId;538 DOMString remoteCertificateId;539 };540 [webrtc-pc]541 5.5. RTCDtlsTransportState Enum542 enum RTCDtlsTransportState {543 "new",544 "connecting",545 "connected",546 "closed",547 "failed"548 };549 5.6. RTCIceRole Enum550 enum RTCIceRole {551 "controlling",552 "controlled"553 };554 8.6. Mandatory To Implement Stats555 - RTCTransportStats, with attributes bytesSent, bytesReceived,556 rtcpTransportStatsId, selectedCandidatePairId, localCertificateId,557 remoteCertificateId558 */559function validateTransportStats(statsReport, stats) {560 validateRtcStats(statsReport, stats);561 assert_optional_unsigned_int_field(stats, 'packetsSent');562 assert_optional_unsigned_int_field(stats, 'packetsReceived');563 assert_unsigned_int_field(stats, 'bytesSent');564 assert_unsigned_int_field(stats, 'bytesReceived');565 validateIdField(statsReport, stats, 'rtcpTransportStatsId', 'transport');566 assert_optional_enum_field(stats, 'iceRole',567 ['controlling', 'controlled']);568 assert_optional_enum_field(stats, 'dtlsState',569 ['new', 'connecting', 'connected', 'closed', 'failed']);570 validateIdField(statsReport, stats, 'selectedCandidatePairId', 'candidate-pair');571 validateIdField(statsReport, stats, 'localCertificateId', 'certificate');572 validateIdField(statsReport, stats, 'remoteCertificateId', 'certificate');573}574/*575 [webrtc-stats]576 7.15. RTCIceCandidateStats dictionary577 dictionary RTCIceCandidateStats : RTCStats {578 DOMString transportId;579 boolean isRemote;580 RTCNetworkType networkType;581 DOMString ip;582 long port;583 DOMString protocol;584 RTCIceCandidateType candidateType;585 long priority;586 DOMString url;587 DOMString relayProtocol;588 boolean deleted = false;589 };590 enum RTCNetworkType {591 "bluetooth",592 "cellular",593 "ethernet",594 "wifi",595 "wimax",596 "vpn",597 "unknown"598 };599 [webrtc-pc]600 4.8.1.3. RTCIceCandidateType Enum601 enum RTCIceCandidateType {602 "host",603 "srflx",604 "prflx",605 "relay"606 };607 8.6. Mandatory To Implement Stats608 - RTCIceCandidateStats, with attributes ip, port, protocol, candidateType,609 priority, url610 */611function validateIceCandidateStats(statsReport, stats) {612 validateRtcStats(statsReport, stats);613 validateOptionalIdField(statsReport, stats, 'transportId', 'transport');614 assert_optional_boolean_field(stats, 'isRemote');615 assert_optional_enum_field(stats, 'networkType',616 ['bluetooth', 'cellular', 'ethernet', 'wifi', 'wimax', 'vpn', 'unknown'])617 assert_string_field(stats, 'ip');618 assert_int_field(stats, 'port');619 assert_string_field(stats, 'protocol');620 assert_enum_field(stats, 'candidateType',621 ['host', 'srflx', 'prflx', 'relay']);622 assert_int_field(stats, 'priority');623 assert_string_field(stats, 'url');624 assert_optional_string_field(stats, 'relayProtocol');625 assert_optional_boolean_field(stats, 'deleted');626}627/*628 [webrtc-stats]629 7.16. RTCIceCandidatePairStats dictionary630 dictionary RTCIceCandidatePairStats : RTCStats {631 DOMString transportId;632 DOMString localCandidateId;633 DOMString remoteCandidateId;634 RTCStatsIceCandidatePairState state;635 unsigned long long priority;636 boolean nominated;637 unsigned long packetsSent;638 unsigned long packetsReceived;639 unsigned long long bytesSent;640 unsigned long long bytesReceived;641 DOMHighResTimeStamp lastPacketSentTimestamp;642 DOMHighResTimeStamp lastPacketReceivedTimestamp;643 DOMHighResTimeStamp firstRequestTimestamp;644 DOMHighResTimeStamp lastRequestTimestamp;645 DOMHighResTimeStamp lastResponseTimestamp;646 double totalRoundTripTime;647 double currentRoundTripTime;648 double availableOutgoingBitrate;649 double availableIncomingBitrate;650 unsigned long circuitBreakerTriggerCount;651 unsigned long long requestsReceived;652 unsigned long long requestsSent;653 unsigned long long responsesReceived;654 unsigned long long responsesSent;655 unsigned long long retransmissionsReceived;656 unsigned long long retransmissionsSent;657 unsigned long long consentRequestsSent;658 DOMHighResTimeStamp consentExpiredTimestamp;659 };660 enum RTCStatsIceCandidatePairState {661 "frozen",662 "waiting",663 "in-progress",664 "failed",665 "succeeded"666 };667 [webrtc-pc]668 8.6. Mandatory To Implement Stats669 - RTCIceCandidatePairStats, with attributes transportId, localCandidateId,670 remoteCandidateId, state, priority, nominated, bytesSent, bytesReceived, totalRoundTripTime, currentRoundTripTime671 */672function validateIceCandidatePairStats(statsReport, stats) {673 validateRtcStats(statsReport, stats);674 validateIdField(statsReport, stats, 'transportId', 'transport');675 validateIdField(statsReport, stats, 'localCandidateId', 'local-candidate');676 validateIdField(statsReport, stats, 'remoteCandidateId', 'remote-candidate');677 assert_enum_field(stats, 'state',678 ['frozen', 'waiting', 'in-progress', 'failed', 'succeeded']);679 assert_unsigned_int_field(stats, 'priority');680 assert_boolean_field(stats, 'nominated');681 assert_optional_unsigned_int_field(stats, 'packetsSent');682 assert_optional_unsigned_int_field(stats, 'packetsReceived');683 assert_unsigned_int_field(stats, 'bytesSent');684 assert_unsigned_int_field(stats, 'byteReceived');685 assert_optional_number_field(stats, 'lastPacketSentTimestamp');686 assert_optional_number_field(stats, 'lastPacketReceivedTimestamp');687 assert_optional_number_field(stats, 'firstRequestTimestamp');688 assert_optional_number_field(stats, 'lastRequestTimestamp');689 assert_optional_number_field(stats, 'lastResponseTimestamp');690 assert_number_field(stats, 'totalRoundTripTime');691 assert_number_field(stats, 'currentRoundTripTime');692 assert_optional_number_field(stats, 'availableOutgoingBitrate');693 assert_optional_number_field(stats, 'availableIncomingBitrate');694 assert_optional_unsigned_int_field(stats, 'circuitBreakerTriggerCount');695 assert_optional_unsigned_int_field(stats, 'requestsReceived');696 assert_optional_unsigned_int_field(stats, 'requestsSent');697 assert_optional_unsigned_int_field(stats, 'responsesReceived');698 assert_optional_unsigned_int_field(stats, 'responsesSent');699 assert_optional_unsigned_int_field(stats, 'retransmissionsReceived');700 assert_optional_unsigned_int_field(stats, 'retransmissionsSent');701 assert_optional_unsigned_int_field(stats, 'consentRequestsSent');702 assert_optional_number_field(stats, 'consentExpiredTimestamp');703}704/*705 [webrtc-stats]706 7.17. RTCCertificateStats dictionary707 dictionary RTCCertificateStats : RTCStats {708 DOMString fingerprint;709 DOMString fingerprintAlgorithm;710 DOMString base64Certificate;711 DOMString issuerCertificateId;712 };713 [webrtc-pc]714 8.6. Mandatory To Implement Stats715 - RTCCertificateStats, with attributes fingerprint, fingerprintAlgorithm,716 base64Certificate, issuerCertificateId717 */718function validateCertificateStats(statsReport, stats) {719 validateRtcStats(statsReport, stats);720 assert_string_field(stats, 'fingerprint');721 assert_string_field(stats, 'fingerprintAlgorithm');722 assert_string_field(stats, 'base64Certificate');723 assert_string_field(stats, 'issuerCertificateId');...

Full Screen

Full Screen

dictionary-helper.js

Source:dictionary-helper.js Github

copy

Full Screen

...10 const num = object[field];11 assert_true(Number.isInteger(num),12 `Expect dictionary.${field} to be integer`);13}14function assert_string_field(object, field) {15 const str = object[field];16 assert_equals(typeof str, 'string',17 `Expect dictionary.${field} to be string`);18}19function assert_number_field(object, field) {20 const num = object[field];21 assert_equals(typeof num, 'number',22 `Expect dictionary.${field} to be number`);23}24function assert_boolean_field(object, field) {25 const bool = object[field];26 assert_equals(typeof bool, 'boolean',27 `Expect dictionary.${field} to be boolean`);28}29function assert_array_field(object, field) {30 assert_true(Array.isArray(object[field]),31 `Expect dictionary.${field} to be array`);32}33function assert_dict_field(object, field) {34 assert_equals(typeof object[field], 'object',35 `Expect dictionary.${field} to be plain object`);36 assert_not_equals(object[field], null,37 `Expect dictionary.${field} to not be null`);38}39function assert_enum_field(object, field, validValues) {40 assert_string_field(object, field);41 assert_true(validValues.includes(object[field]),42 `Expect dictionary.${field} to have one of the valid enum values: ${validValues}`);43}44function assert_optional_unsigned_int_field(object, field) {45 if(object[field] !== undefined) {46 assert_unsigned_int_field(object, field);47 }48}49function assert_optional_int_field(object, field) {50 if(object[field] !== undefined) {51 assert_int_field(object, field);52 }53}54function assert_optional_string_field(object, field) {55 if(object[field] !== undefined) {56 assert_string_field(object, field);57 }58}59function assert_optional_number_field(object, field) {60 if(object[field] !== undefined) {61 assert_number_field(object, field);62 }63}64function assert_optional_boolean_field(object, field) {65 if(object[field] !== undefined) {66 assert_boolean_field(object, field);67 }68}69function assert_optional_array_field(object, field) {70 if(object[field] !== undefined) {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1assert_string_field("foo", "foo");2assert_string_field("foo", "bar");3assert_equals("foo", "foo");4assert_equals("foo", "bar");5assert_string_field("foo", "foo");6assert_string_field("foo", "bar");7assert_equals("foo", "foo");8assert_equals("foo", "bar");9assert_string_field("foo", "foo");10assert_string_field("foo", "bar");11assert_equals("foo", "foo");12assert_equals("foo", "bar");13assert_string_field("foo", "foo");14assert_string_field("foo", "bar");15assert_equals("foo", "foo");16assert_equals("foo", "bar");17assert_string_field("foo", "foo");18assert_string_field("foo", "bar");19assert_equals("foo", "foo");20assert_equals("foo", "bar");21assert_string_field("foo", "foo");22assert_string_field("foo", "bar");23assert_equals("foo", "foo");24assert_equals("foo", "bar");25assert_string_field("foo", "foo");26assert_string_field("foo", "bar");27assert_equals("foo", "foo");28assert_equals("foo", "bar");

Full Screen

Using AI Code Generation

copy

Full Screen

1function assert_string_field(object, field, expected) {2 assert_equals(object[field], expected);3}4function assert_string_field(object, field, expected) {5 assert_equals(object[field], expected);6}7function assert_string_field(object, field, expected) {8 assert_equals(object[field], expected);9}10function assert_string_field(object, field, expected) {11 assert_equals(object[field], expected);12}13function assert_string_field(object, field, expected) {14 assert_equals(object[field], expected);15}16function assert_string_field(object, field, expected) {17 assert_equals(object[field], expected);18}19function assert_string_field(object, field, expected) {20 assert_equals(object[field], expected);21}22function assert_string_field(object, field, expected) {23 assert_equals(object[field], expected);24}25function assert_string_field(object, field, expected) {26 assert_equals(object[field], expected);27}28function assert_string_field(object, field, expected) {29 assert_equals(object[field], expected);30}31function assert_string_field(object, field, expected) {32 assert_equals(object[field], expected);33}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.assert_string_field("test.js", "assert_string_field");3var wpt = require('./wpt.js');4wpt.assert_string_field("test.js", "assert_string_field");5var wpt = require('./wpt.js');6wpt.assert_string_field("test.js", "assert_string_field");7var wpt = require('./wpt.js');8wpt.assert_string_field("test.js", "assert_string_field");9var wpt = require('./wpt.js');10wpt.assert_string_field("test.js", "assert_string_field");11var wpt = require('./wpt.js');12wpt.assert_string_field("test.js", "assert_string_field");13var wpt = require('./wpt.js');14wpt.assert_string_field("test.js", "assert_string_field");15var wpt = require('./wpt.js');16wpt.assert_string_field("test.js", "assert_string_field");17var wpt = require('./wpt.js');18wpt.assert_string_field("test.js", "assert_string_field");19var wpt = require('./wpt.js');20wpt.assert_string_field("test.js", "assert_string_field");21var wpt = require('./wpt.js');22wpt.assert_string_field("test.js", "assert_string_field");23var wpt = require('./wpt.js');24wpt.assert_string_field("test.js", "assert_string_field");25var wpt = require('./wpt.js');26wpt.assert_string_field("test.js", "assert_string_field");27var wpt = require('./wpt.js');28wpt.assert_string_field("

Full Screen

Using AI Code Generation

copy

Full Screen

1assert_string_field("test", "test", "test");2assert_array_field("test", "test", "test");3assert_object_field("test", "test", "test");4assert_boolean_field("test", "test", "test");5assert_number_field("test", "test", "test");6assert_null_field("test", "test", "test");7assert_undefined_field("test", "test", "test");8assert_not_null_field("test", "test", "test");9assert_not_undefined_field("test", "test", "test");10assert_not_empty_field("test", "test", "test");11assert_empty_field("test", "test", "test");12assert_string_contains("test", "test", "test");13assert_string_not_contains("test", "test", "test");14assert_true("test", "test", "test");15assert_false("test", "test", "test");16assert_equals("test", "test", "test");

Full Screen

Using AI Code Generation

copy

Full Screen

1var test = new wpt_test();2var test_result = test.assert_string_field("test", "test");3var test = new wpt_test();4var test_result = test.assert_string_field("test", "test");5var test = new wpt_test();6var test_result = test.assert_string_field("test", "test");7var test = new wpt_test();8var test_result = test.assert_string_field("test", "test");9var test = new wpt_test();10var test_result = test.assert_string_field("test", "test");11var test = new wpt_test();12var test_result = test.assert_string_field("test", "test");13var test = new wpt_test();14var test_result = test.assert_string_field("test", "test");15var test = new wpt_test();16var test_result = test.assert_string_field("test", "test");17var test = new wpt_test();18var test_result = test.assert_string_field("test", "test");

Full Screen

Using AI Code Generation

copy

Full Screen

1var test_object = {test:"test"};2assert_string_field(test_object, "test");3var script = document.createElement('script');4script.src = 'test.js';5document.getElementsByTagName('head')[0].appendChild(script);6var test_object = {test:"test"};7assert_string_field(test_object, "test");8var script = document.createElement('script');9script.src = 'test.js';10document.getElementsByTagName('head')[0].appendChild(script);11var test_object = {test:"test"};12assert_string_field(test_object, "test");13var script = document.createElement('script');14script.src = 'test.js';15document.getElementsByTagName('head')[0].appendChild(script);16var test_object = {test:"test"};17assert_string_field(test_object, "test");18var script = document.createElement('script');19script.src = 'test.js';20document.getElementsByTagName('head')[0].appendChild(script);21var test_object = {test:"test"};22assert_string_field(test_object, "test");23var script = document.createElement('script');24script.src = 'test.js';25document.getElementsByTagName('head')[0].appendChild(script);26var test_object = {test:"test"};27assert_string_field(test_object, "test");28var script = document.createElement('script');29script.src = 'test.js';30document.getElementsByTagName('head')[0].appendChild(script);31var test_object = {test:"test"};32assert_string_field(test_object, "test");33var script = document.createElement('script');

Full Screen

Using AI Code Generation

copy

Full Screen

1assert_string_field("this is a string", "length", 14);2assert_string_field("this is a string", "length", 13);3assert_string_field() method4The assert_string_field() method takes 3 parameters:5assert_string_field() method can be used to assert other data types as well. The assert_string_field() method can be used to assert a field of the following data types:6assert_string_field() method for asserting a string7The assert_string_field() method can be used to assert a string. The assert_string_field() method takes 3 parameters:8The assert_string_field() method for asserting a string is shown below:9module.exports.assert_string_field = function (actual, field, expected) {10 if (actual[field] !== expected) {11 throw new Error(`Expected ${actual} to have a field ${field} of ${expected}, but got ${actual[field]}`);12 }13};14assert_string_field() method for asserting a number15The assert_string_field() method can be used to assert a number. The assert_string_field() method takes 3 parameters:16The assert_string_field() method will throw an error if the actual value of the number is

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful