summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/general
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-20 09:47:03 +0000
commit5165ed02285315cc0bed7977c7bac6d0a90ca43c (patch)
tree9b761a21eb924915e51c2d803208e6c01b505a45 /dom/tests/mochitest/general
parente1db27e19989db11fef70f439cf95821316535b3 (diff)
parentca9abcdf1702c37bf00048dab3f460b2252873a3 (diff)
downloadUXP-5165ed02285315cc0bed7977c7bac6d0a90ca43c.tar
UXP-5165ed02285315cc0bed7977c7bac6d0a90ca43c.tar.gz
UXP-5165ed02285315cc0bed7977c7bac6d0a90ca43c.tar.lz
UXP-5165ed02285315cc0bed7977c7bac6d0a90ca43c.tar.xz
UXP-5165ed02285315cc0bed7977c7bac6d0a90ca43c.zip
Merge branch 'redwood' into releaseRELBASE_20201124RELBASE_20201120RC_20201120
Diffstat (limited to 'dom/tests/mochitest/general')
-rwxr-xr-xdom/tests/mochitest/general/mochitest.ini1
-rw-r--r--dom/tests/mochitest/general/test_vibrator.html93
2 files changed, 0 insertions, 94 deletions
diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini
index 9f2fad785..67c35f01a 100755
--- a/dom/tests/mochitest/general/mochitest.ini
+++ b/dom/tests/mochitest/general/mochitest.ini
@@ -122,7 +122,6 @@ run-if = e10s
[test_storagePermissionsReject.html]
[test_storagePermissionsRejectForeign.html]
[test_stylesheetPI.html]
-[test_vibrator.html]
[test_WebKitCSSMatrix.html]
[test_windowedhistoryframes.html]
[test_windowProperties.html]
diff --git a/dom/tests/mochitest/general/test_vibrator.html b/dom/tests/mochitest/general/test_vibrator.html
deleted file mode 100644
index 2874c783b..000000000
--- a/dom/tests/mochitest/general/test_vibrator.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test for Vibrator</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<!-- Although we can't test that the vibrator works properly, we can test that
- navigator.vibrate throws an exception where appropriate. -->
-
-<script class="testbody" type="text/javascript;version=1.7">
-SimpleTest.waitForExplicitFinish();
-var result;
-function expectFailure(param) {
- result = navigator.vibrate(param);
- is(result, false, 'vibrate(' + param + ') should have failed.');
-}
-
-function expectSuccess(param) {
- result = navigator.vibrate(param);
- is(result, true, 'vibrate(' + param + ') must succeed.');
-}
-
-function tests(aEnabled) {
- // Some edge cases that the bindings should handle for us.
- expectSuccess(null);
- expectSuccess(undefined);
- // -1 will be converted to the highest unsigned long then clamped.
- expectSuccess(-1);
- expectSuccess('a');
- // -1 will be converted to the highest unsigned long then clamped.
- expectSuccess([100, -1]);
- expectSuccess([100, 'a']);
-
- var maxVibrateMs = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_ms');
- var maxVibrateListLen = SpecialPowers.getIntPref('dom.vibrator.max_vibrate_list_len');
-
- // If we pass a vibration pattern with a value higher than max_vibrate_ms or a
- // pattern longer than max_vibrate_list_len, the call should succeed but the
- // pattern should be modified to match the restrictions.
-
- // Values will be clamped to dom.vibrator.max_vibrate_ms.
- expectSuccess(maxVibrateMs + 1);
- expectSuccess([maxVibrateMs + 1]);
-
- var arr = [];
- for (var i = 0; i < maxVibrateListLen + 1; i++) {
- arr[i] = 0;
- }
- // The array will be truncated to have a length equal to dom.vibrator.max_vibrate_list_len.
- expectSuccess(arr);
-
-
- expectSuccess(0);
- expectSuccess([]);
- expectSuccess('1000');
- expectSuccess(1000);
- expectSuccess(1000.1);
- expectSuccess([0, 0, 0]);
- expectSuccess(['1000', 1000]);
- expectSuccess([1000, 1000]);
- expectSuccess([1000, 1000.1]);
-
- // The following loop shouldn't cause us to crash. See bug 701716.
- for (var i = 0; i < 10000; i++) {
- navigator.vibrate([100, 100]);
- }
- ok(true, "Didn't crash after issuing a lot of vibrate() calls.");
- if(!aEnabled)
- SimpleTest.finish();
-}
-
-SpecialPowers.pushPermissions([
- {type: 'vibration', allow: true, context: document}
- ], function() {
- // Test with the vibrator pref enabled.
- SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]}, function() {
- tests(true);
- SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', false]]}, tests(false));
- });
- // Everything should be the same when the vibrator is disabled -- in
- // particular, a disabled vibrator shouldn't eat failures we'd otherwise
- // observe.
- }
-);
-
-</script>
-</body>
-
-</html>