summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_source_media.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/test_source_media.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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_source_media.html')
-rw-r--r--dom/media/test/test_source_media.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/dom/media/test/test_source_media.html b/dom/media/test/test_source_media.html
new file mode 100644
index 000000000..0889ef050
--- /dev/null
+++ b/dom/media/test/test_source_media.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Media test: media attribute for the source element.</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>
+<script type="text/javascript" src="../../../dom/html/test/reflect.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="text/javascript">
+ var testCount = 0;
+ function notifyFinished() {
+ testCount++;
+ if (testCount == 2) {
+ SimpleTest.finish();
+ }
+ }
+
+ function clearNode(n) {
+ n.remove();
+ n.src = "";
+ while (n.firstChild) {
+ n.removeChild(n.firstChild);
+ }
+ }
+
+ SimpleTest.waitForExplicitFinish();
+
+ reflectString({
+ element: document.createElement("source"),
+ attribute: "media",
+ });
+
+ var media = getPlayableVideo(gSmallTests);
+
+ if (media == null) {
+ todo(false, "No media supported.");
+ SimpleTest.finish();
+ } else {
+ var v = document.createElement('video');
+ v.preload = "metadata";
+ v.innerHTML = "<source src=\"" + media.name + "?fail\" media=\"not all\">" +
+ "<source src=\""+ media.name + "?pass\" media=\"all\">";
+ var v2 = document.createElement("video");
+ v2.preload = "metadata";
+ v2.innerHTML = "<source src=\""+ media.name +"?pass\">" +
+ "<source src=\""+ media.name + "?fail\" media=\"all\">";
+ document.body.appendChild(v);
+ document.body.appendChild(v2);
+
+ v.addEventListener("loadedmetadata", function(e) {
+ ok(/pass/.test(e.target.currentSrc),
+ "The source has been chosen according to the media attribute.");
+ clearNode(e.target);
+ notifyFinished();
+ });
+ v2.addEventListener("loadedmetadata", function(e) {
+ ok(/pass/.test(e.target.currentSrc),
+ "If no media attribute is specified, it defaults to \'all\'.")
+ clearNode(e.target);
+ notifyFinished();
+ });
+ }
+
+</script>
+</pre>
+</body>
+</html>