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("Tests MediaStreamTrack::getSources.");
16 testFailed('Stream generation failed.');
20 function getUserMedia(constraints
, callback
) {
22 navigator
.webkitGetUserMedia(constraints
, callback
, error
);
24 testFailed('webkitGetUserMedia threw exception :' + e
);
29 function gotSources2(s
) {
30 testPassed('gotSources2 was called.');
32 shouldBeTrue('sources.length > 0');
33 shouldBeTrue('sources[0].id === previousId');
34 shouldBeTrue('sources[0].label.length > 0');
39 function gotStream(s
) {
40 testPassed('gotStream was called.');
42 shouldNotThrow('MediaStreamTrack.getSources(gotSources2);');
45 function gotSources1(s
) {
46 testPassed('gotSources1 was called.');
48 shouldBeTrue('sources.length > 0');
49 previousId
= sources
[0].id
;
51 getUserMedia({audio
:true, video
:true}, gotStream
);
54 shouldNotThrow('MediaStreamTrack.getSources(gotSources1);');
56 window
.jsTestIsAsync
= true;
57 window
.successfullyParsed
= true;