RTCDTMFSender-ontonechange-long.https.html (1658B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <meta name="timeout" content="long"> 4 <title>RTCDTMFSender.prototype.ontonechange (Long Timeout)</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="RTCPeerConnection-helper.js"></script> 8 <script src="RTCDTMFSender-helper.js"></script> 9 <script> 10 'use strict'; 11 12 // Test is based on the following editor draft: 13 // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html 14 15 // The following helper functions are called from RTCDTMFSender-helper.js 16 // test_tone_change_events 17 18 /* 19 7. Peer-to-peer DTMF 20 partial interface RTCRtpSender { 21 readonly attribute RTCDTMFSender? dtmf; 22 }; 23 24 interface RTCDTMFSender : EventTarget { 25 void insertDTMF(DOMString tones, 26 optional unsigned long duration = 100, 27 optional unsigned long interToneGap = 70); 28 attribute EventHandler ontonechange; 29 readonly attribute DOMString toneBuffer; 30 }; 31 32 [Constructor(DOMString type, RTCDTMFToneChangeEventInit eventInitDict)] 33 interface RTCDTMFToneChangeEvent : Event { 34 readonly attribute DOMString tone; 35 }; 36 */ 37 38 /* 39 7.2. insertDTMF 40 8. If the value of the duration parameter is less than 40, set it to 40. 41 If, on the other hand, the value is greater than 6000, set it to 6000. 42 */ 43 test_tone_change_events((t, dtmfSender) => { 44 dtmfSender.insertDTMF('A', 8000, 70); 45 }, [ 46 ['A', '', 0], 47 ['', '', 6070] 48 ],'insertDTMF with duration greater than 6000 should be clamped to 6000'); 49 50 </script>