1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 description("Tests RTCDTMFSender.");
12 var dtmfsender
= null;
15 testFailed('Error callback called.');
21 function ontonechange(e
) {
22 testPassed("ontonechange was called.");
25 shouldBeEqualToString('event.tone', "1");
28 shouldBeEqualToString('event.tone', "");
33 function pc_onicechange() {
34 if (pc
.iceConnectionState
=== "completed") {
35 testPassed("pc is connected");
36 track
= stream
.getAudioTracks()[0];
38 shouldThrow('dtmfsender = pc.createDTMFSender(track);');
40 shouldNotThrow('dtmfsender = pc.createDTMFSender(track);');
41 shouldBeTrue('dtmfsender.canInsertDTMF');
43 dtmfsender
.ontonechange
= ontonechange
;
44 dtmfsender
.insertDTMF("1");
45 shouldBeEqualToString('dtmfsender.toneBuffer', "1");
49 function gotStream(s
) {
51 testPassed('Stream generated.');
52 shouldBe('stream.getAudioTracks().length', '1');
53 shouldBe('stream.getVideoTracks().length', '0');
55 pc
= new webkitRTCPeerConnection(null, null);
56 pc
.oniceconnectionstatechange
= pc_onicechange
;
59 shouldNotThrow("navigator.webkitGetUserMedia({audio:true}, gotStream, error);");
61 window
.jsTestIsAsync
= true;
62 window
.successfullyParsed
= true;