summaryrefslogtreecommitdiffstats
path: root/dom/media/test/can_play_type_ogg.js
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/can_play_type_ogg.js
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/can_play_type_ogg.js')
-rw-r--r--dom/media/test/can_play_type_ogg.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/dom/media/test/can_play_type_ogg.js b/dom/media/test/can_play_type_ogg.js
new file mode 100644
index 000000000..b9678bcac
--- /dev/null
+++ b/dom/media/test/can_play_type_ogg.js
@@ -0,0 +1,78 @@
+
+function check_ogg(v, enabled, finish) {
+ function check(type, expected) {
+ is(v.canPlayType(type), enabled ? expected : "", type);
+ }
+
+ function basic_test() {
+ return new Promise(function(resolve, reject) {
+ // Ogg types
+ check("video/ogg", "maybe");
+ check("audio/ogg", "maybe");
+ check("application/ogg", "maybe");
+
+ // Supported Ogg codecs
+ check("audio/ogg; codecs=vorbis", "probably");
+ check("video/ogg; codecs=vorbis", "probably");
+ check("video/ogg; codecs=vorbis,theora", "probably");
+ check("video/ogg; codecs=\"vorbis, theora\"", "probably");
+ check("video/ogg; codecs=theora", "probably");
+
+ resolve();
+ });
+ }
+
+ // Verify Opus support
+ function verify_opus_support() {
+ return new Promise(function(resolve, reject) {
+ var OpusEnabled = undefined;
+ try {
+ OpusEnabled = SpecialPowers.getBoolPref("media.opus.enabled");
+ } catch (ex) {
+ // SpecialPowers failed, perhaps because Opus isn't compiled in
+ console.log("media.opus.enabled pref not found; skipping Opus validation");
+ }
+ if (OpusEnabled != undefined) {
+ resolve();
+ } else {
+ reject();
+ }
+ });
+ }
+
+ function opus_enable() {
+ return new Promise(function(resolve, reject) {
+ SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', true]]},
+ function() {
+ check("audio/ogg; codecs=opus", "probably");
+ resolve();
+ });
+ });
+ }
+
+ function opus_disable() {
+ return new Promise(function(resolve, reject) {
+ SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', false]]},
+ function() {
+ check("audio/ogg; codecs=opus", "");
+ resolve();
+ });
+ });
+ }
+
+ function unspported_ogg() {
+ // Unsupported Ogg codecs
+ check("video/ogg; codecs=xyz", "");
+ check("video/ogg; codecs=xyz,vorbis", "");
+ check("video/ogg; codecs=vorbis,xyz", "");
+
+ finish.call();
+ }
+
+ basic_test()
+ .then(verify_opus_support)
+ .then(opus_enable)
+ .then(opus_disable)
+ .then(unspported_ogg, unspported_ogg);
+
+}