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/test/test_streams_srcObject.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/test/test_streams_srcObject.html')
-rw-r--r-- | dom/media/test/test_streams_srcObject.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/dom/media/test/test_streams_srcObject.html b/dom/media/test/test_streams_srcObject.html new file mode 100644 index 000000000..a5a4205cd --- /dev/null +++ b/dom/media/test/test_streams_srcObject.html @@ -0,0 +1,62 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test interactions of src and srcObject</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + <script type="text/javascript" src="manifest.js"></script> +</head> +<body onload="doTests()"> +<audio id="a1"></audio> +<audio id="a2"></audio> +<pre id="test"> +<script class="testbody" type="text/javascript"> +SimpleTest.waitForExplicitFinish(); + +var doTest = srcObject => new Promise(resolve => { + var a = document.getElementById('a1'); + a.src = getPlayableAudio(gSmallTests).name; + var b = new Audio(); + + var newSrc = a.src + "?2"; + b.src = newSrc; + is(b[srcObject], null, "Initial srcObject is null"); + var stream = a.mozCaptureStream(); + b[srcObject] = stream; + is(b[srcObject], stream, "Stream set correctly"); + try { + b[srcObject] = "invalid"; + ok(false, "Setting srcObject to an invalid value should throw."); + } catch (e) { + ok(e instanceof TypeError, "Exception should be a TypeError"); + } + is(b[srcObject], stream, "Stream not set to invalid value"); + is(b.src, newSrc, "src attribute not affected by setting srcObject"); + var step = 0; + b.addEventListener("loadedmetadata", function() { + if (step == 0) { + is(b.currentSrc, "", "currentSrc set to empty string while playing srcObject"); + b[srcObject] = null; + is(b[srcObject], null, "Stream set to null"); + // The resource selection algorithm will run again and choose b.src + } else if (step == 1) { + is(b.currentSrc, b.src, "currentSrc set to src now that srcObject is null"); + resolve(); + } + ++step; + }); + a.play(); + b.play(); +}); + +// TODO: remove prefixed version soon (1183495). + +var doTests = () => doTest("srcObject").then(() => doTest("mozSrcObject")) + .catch(e => ok(false, "Unexpected error: " + e)) + .then(() => SimpleTest.finish()) + .catch(e => ok(false, "Coding error: " + e)); + +</script> +</pre> +</body> +</html> |