1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description("Test onactive/oninactive callback.");
13 testFailed('Stream generation failed.');
17 function getUserMedia(dictionary
, callback
) {
19 navigator
.webkitGetUserMedia(dictionary
, callback
, error
);
21 testFailed('webkitGetUserMedia threw exception :' + e
);
28 function streamActive() {
29 testPassed('streamActive was called.');
30 shouldBeTrue('stream.active');
34 function gotStream2(s
) {
35 stream
= new webkitMediaStream();
36 shouldBeFalse('stream.active');
37 stream
.onactive
= streamActive
;
38 stream
.addTrack(s
.getAudioTracks()[0]);
41 function streamInactive() {
42 testPassed('streamInactive was called.');
43 shouldBeFalse('stream.active');
45 getUserMedia({audio
:true, video
:true}, gotStream2
);
48 function gotStream(s
) {
50 shouldBeTrue('stream.active');
51 stream
.oninactive
= streamInactive
;
52 shouldBe('stream.getAudioTracks().length', '1');
53 shouldBe('stream.getVideoTracks().length', '1');
54 stream
.removeTrack(stream
.getAudioTracks()[0]);
55 stream
.removeTrack(stream
.getVideoTracks()[0]);
58 getUserMedia({audio
:true, video
:true}, gotStream
);
60 window
.jsTestIsAsync
= true;
61 window
.successfullyParsed
= true;