| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="./resources/getUserMedia-helper.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description("Tests MediaStream assignment to MediaElement using 'srcObject' MediaElement attribute."); |
| |
| var stream; |
| var errorArg; |
| |
| function error() |
| { |
| testFailed('Error callback called.'); |
| finishJSTest(); |
| } |
| |
| function testNullStreamObject(stream, audio) |
| { |
| shouldNotThrow("audio.srcObject = null;"); |
| shouldNotThrow("streamObj = audio.srcObject;"); |
| shouldBe('streamObj', 'null'); |
| finishJSTest(); |
| } |
| |
| function gotStream(s) |
| { |
| stream = s; |
| shouldBe('stream.getAudioTracks().length', '1'); |
| shouldBe('stream.getVideoTracks().length', '0'); |
| |
| audio = new Audio(); |
| shouldNotThrow("audio.srcObject = stream;"); |
| shouldNotThrow("streamObj = audio.srcObject;"); |
| shouldBe('streamObj', 'stream'); |
| shouldBe('streamObj.getAudioTracks().length', '1'); |
| shouldBe('streamObj.getVideoTracks().length', '0'); |
| shouldBe('streamObj.id', 'stream.id'); |
| testPassed('stream assigned to media element.'); |
| |
| testNullStreamObject(stream, audio); |
| } |
| |
| shouldNotThrow("getUserMedia('allow', {audio:true}, gotStream)"); |
| |
| window.jsTestIsAsync = true; |
| window.successfullyParsed = true; |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |