summaryrefslogtreecommitdiff
path: root/dom/speakermanager/tests
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/speakermanager/tests
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloaduxp-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/speakermanager/tests')
-rw-r--r--dom/speakermanager/tests/mochitest.ini3
-rw-r--r--dom/speakermanager/tests/test_speakermanager.html53
2 files changed, 56 insertions, 0 deletions
diff --git a/dom/speakermanager/tests/mochitest.ini b/dom/speakermanager/tests/mochitest.ini
new file mode 100644
index 0000000000..bb272adc00
--- /dev/null
+++ b/dom/speakermanager/tests/mochitest.ini
@@ -0,0 +1,3 @@
+[DEFAULT]
+
+[test_speakermanager.html]
diff --git a/dom/speakermanager/tests/test_speakermanager.html b/dom/speakermanager/tests/test_speakermanager.html
new file mode 100644
index 0000000000..509df5e84a
--- /dev/null
+++ b/dom/speakermanager/tests/test_speakermanager.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test MozSpeakerManager API</title>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+ <script type="application/javascript">
+
+ "use strict";
+
+ function testObject() {
+ var mgr = new MozSpeakerManager();
+ var spkforced = false;
+ mgr.onspeakerforcedchange = function() {
+ if (spkforced) {
+ is(mgr.speakerforced, true, 'speaker should be true');
+ spkforced = false;
+ mgr.forcespeaker = false;
+ } else {
+ is(mgr.speakerforced, false, 'speaker should be false');
+ SimpleTest.finish();
+ }
+ }
+ spkforced = true;
+ mgr.forcespeaker = true;
+ }
+
+ function startTests() {
+ // Currently applicable only on FxOS
+ if (navigator.userAgent.indexOf("Mobile") != -1 &&
+ navigator.appVersion.indexOf("Android") == -1) {
+ testObject();
+ } else {
+ ok(true, "MozSpeakerManager on Firefox OS only.");
+ SimpleTest.finish();
+ }
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ SpecialPowers.pushPermissions(
+ [{ "type": "speaker-control", "allow": 1, "context": document }],
+ startTests);
+
+ </script>
+</pre>
+</body>
+</html>