1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 description("Test cloning mediastreams and their tracks.");
17 testFailed('Stream generation failed.');
21 function getUserMedia(dictionary
, callback
) {
23 navigator
.webkitGetUserMedia(dictionary
, callback
, error
);
25 testFailed('webkitGetUserMedia threw exception :' + e
);
30 function gotStream2(s
) {
32 track
= stream2
.getAudioTracks()[0];
33 cloned_track
= track
.clone();
34 shouldNotBe('track', 'cloned_track');
35 shouldNotBe('track.id', 'cloned_track.id');
36 stream
.addTrack(cloned_track
);
37 shouldBe('stream.getAudioTracks().length', '2');
41 function gotStream(s
) {
43 shouldBe('stream.getAudioTracks().length', '1');
44 shouldBe('stream.getVideoTracks().length', '1');
46 cloned_stream
= stream
.clone();
47 shouldNotBe('stream.id', 'cloned_stream.id');
48 shouldBe('cloned_stream.getAudioTracks().length', '1');
49 shouldBe('cloned_stream.getVideoTracks().length', '1');
51 shouldNotBe('stream.getAudioTracks()[0]', 'cloned_stream.getAudioTracks()[0]');
52 shouldNotBe('stream.getVideoTracks()[0]', 'cloned_stream.getVideoTracks()[0]');
53 shouldNotBe('stream.getAudioTracks()[0].id', 'cloned_stream.getAudioTracks()[0].id');
54 shouldNotBe('stream.getVideoTracks()[0].id', 'cloned_stream.getVideoTracks()[0].id');
56 getUserMedia({audio
:true, video
:true}, gotStream2
);
59 getUserMedia({audio
:true, video
:true}, gotStream
);
61 window
.jsTestIsAsync
= true;
62 window
.successfullyParsed
= true;