diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/tests/mochitest/test_peerConnection_capturedVideo.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/tests/mochitest/test_peerConnection_capturedVideo.html')
-rw-r--r-- | dom/media/tests/mochitest/test_peerConnection_capturedVideo.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html new file mode 100644 index 000000000..27bcc9a52 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html @@ -0,0 +1,87 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> + <script type="text/javascript" src="../../test/manifest.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript;version=1.8"> +var manager = new MediaTestManager; + +createHTML({ + bug: "1081409", + title: "Captured video-only over peer connection", + visible: true +}).then(() => new Promise(resolve => { + manager.runTests(getPlayableVideos(gLongerTests), startTest); + manager.onFinished = () => { + // Tear down before SimpleTest.finish. + if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) { + getNetworkUtils().tearDownNetwork(); + } + resolve(); + }; +})) +.catch(e => ok(false, "Unexpected " + e + ":\n" + e.stack)); + +// Run tests in sequence for log readability. +PARALLEL_TESTS = 1; + +function startTest(media, token) { + manager.started(token); + var video = document.createElement('video'); + video.id = "id_" + media.name; + video.width = 160; + video.height = 120; + video.muted = true; + video.loop = true; + video.preload = "metadata"; + video.src = "../../test/" + media.name; + + document.getElementById("content").appendChild(video); + + var test; + new Promise((resolve, reject) => { + video.onloadedmetadata = resolve; + video.onerror = () => reject(video.error); + }) + .then(() => { + video.onerror = () => ok(false, media.name + " failed in playback (code=" + + video.error.code + "). Stream should be OK. " + + "Continuing test."); + return runNetworkTest(() => { + var stream = video.mozCaptureStream(); + test = new PeerConnectionTest({ config_local: { label_suffix: media.name }, + config_remote: { label_suffix: media.name } }); + test.setOfferOptions({ offerToReceiveVideo: false, + offerToReceiveAudio: false }); + var hasVideo = stream.getVideoTracks().length > 0; + var hasAudio = stream.getAudioTracks().length > 0; + test.setMediaConstraints([{ video: hasVideo, audio: hasAudio }], []); + test.chain.replace("PC_LOCAL_GUM", [ + function PC_LOCAL_CAPTUREVIDEO(test) { + test.pcLocal.attachLocalStream(stream); + video.play(); + } + ]); + return test.chain.execute(); + }); + }) + // Handle both MediaErrors (with the `code` attribute) and other errors. + .catch(e => ok(false, "Error (" + e + ")" + + (e.code ? " (code=" + e.code + ")" : "") + + " in test for " + media.name + + (e.stack ? ":\n" + e.stack : ""))) + .then(() => test && test.close()) + .then(() => { + removeNodeAndSource(video); + manager.finished(token); + }) + .catch(e => ok(false, "Error (" + e + ") during shutdown.")); +}; + +</script> +</pre> +</body> +</html> |