| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <p id="description"></p> | |
| 8 <div id="console"></div> | |
| 9 <script> | |
| 10 description("Tests MediaStreamTrack::getSources."); | |
| 11 | |
| 12 var sources = null; | |
| 13 var previousId; | |
| 14 | |
| 15 function error() { | |
| 16 testFailed('Stream generation failed.'); | |
| 17 finishJSTest(); | |
| 18 } | |
| 19 | |
| 20 function getUserMedia(constraints, callback) { | |
| 21 try { | |
| 22 navigator.webkitGetUserMedia(constraints, callback, error); | |
| 23 } catch (e) { | |
| 24 testFailed('webkitGetUserMedia threw exception :' + e); | |
| 25 finishJSTest(); | |
| 26 } | |
| 27 } | |
| 28 | |
| 29 function gotSources2(s) { | |
| 30 testPassed('gotSources2 was called.'); | |
| 31 sources = s; | |
| 32 shouldBeTrue('sources.length > 0'); | |
| 33 shouldBeTrue('sources[0].id === previousId'); | |
| 34 shouldBeTrue('sources[0].label.length > 0'); | |
| 35 | |
| 36 finishJSTest(); | |
| 37 } | |
| 38 | |
| 39 function gotStream(s) { | |
| 40 testPassed('gotStream was called.'); | |
| 41 | |
| 42 shouldNotThrow('MediaStreamTrack.getSources(gotSources2);'); | |
| 43 } | |
| 44 | |
| 45 function gotSources1(s) { | |
| 46 testPassed('gotSources1 was called.'); | |
| 47 sources = s; | |
| 48 shouldBeTrue('sources.length > 0'); | |
| 49 previousId = sources[0].id; | |
| 50 | |
| 51 getUserMedia({audio:true, video:true}, gotStream); | |
| 52 } | |
| 53 | |
| 54 shouldNotThrow('MediaStreamTrack.getSources(gotSources1);'); | |
| 55 | |
| 56 window.jsTestIsAsync = true; | |
| 57 window.successfullyParsed = true; | |
| 58 </script> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |