1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
8 description("Test cloning mediastreams onactive/oninactive callbacks.");
13 testFailed('Stream generation failed.');
17 function getUserMedia(dictionary
, callback
) {
19 navigator
.webkitGetUserMedia(dictionary
, callback
, error
);
21 testFailed('webkitGetUserMedia threw exception :' + e
);
26 function onStreamActive() {
27 testPassed('Clone stream active.');
28 shouldBeTrue('cloned_stream.active');
32 function gotStream2(s
) {
33 cloned_stream
.onactive
= onStreamActive
;
34 cloned_stream
.addTrack(s
.getVideoTracks()[0]);
37 function onStreamInactive() {
38 testPassed('Clone stream inactive.');
39 shouldBeFalse('cloned_stream.active');
41 getUserMedia({audio
:true, video
:true}, gotStream2
);
44 function gotStream(s
) {
47 cloned_stream
= stream
.clone();
48 cloned_stream
.oninactive
= onStreamInactive
;
49 shouldBeTrue('cloned_stream.active');
50 shouldBe('cloned_stream.getVideoTracks().length', '1');
51 shouldBe('cloned_stream.getAudioTracks().length', '1');
52 cloned_stream
.getVideoTracks()[0].stop();
53 cloned_stream
.getAudioTracks()[0].stop();
56 getUserMedia({audio
:true, video
:true}, gotStream
);
58 window
.jsTestIsAsync
= true;
59 window
.successfullyParsed
= true;