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 /testing/web-platform/tests/vibration | |
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 'testing/web-platform/tests/vibration')
15 files changed, 455 insertions, 0 deletions
diff --git a/testing/web-platform/tests/vibration/OWNERS b/testing/web-platform/tests/vibration/OWNERS new file mode 100644 index 000000000..4020ed82e --- /dev/null +++ b/testing/web-platform/tests/vibration/OWNERS @@ -0,0 +1,3 @@ +@dontcallmedom +@zqzhang +@xinliux diff --git a/testing/web-platform/tests/vibration/api-is-present.html b/testing/web-platform/tests/vibration/api-is-present.html new file mode 100644 index 000000000..f5c976dff --- /dev/null +++ b/testing/web-platform/tests/vibration/api-is-present.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test that the vibrate() method is present (with or without vendor prefix)</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom'/> + <meta name='assert' content='Check that the vibrate() method is present.'/> + </head> + <body> + <h1>Description</h1> + <p> + This test checks for the presence of the <code>vibrate()</code> method, taking + vendor prefixes into account. + </p> + <div id='log'></div> + <script src='/resources/testharness.js'></script> + <script src='/resources/testharnessreport.js'></script> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + test(function () { + assert_true(undefined !== navigator.vibrate, "navigator.vibrate exists"); + }, "vibrate() is present on navigator"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/cancel-when-hidden-manual.html b/testing/web-platform/tests/vibration/cancel-when-hidden-manual.html new file mode 100644 index 000000000..569970758 --- /dev/null +++ b/testing/web-platform/tests/vibration/cancel-when-hidden-manual.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<meta charset='utf-8'> +<title>Vibration API: cancel ongoing vibrate() when hidden by switching tab/window</title> +<link rel='author' title='Intel' href='http://www.intel.com'> +<link rel='help' href='http://dev.w3.org/2009/dap/vibration/#vibration-interface'> +<meta name='flags' content='interact'> +<meta name='assert' content='If the visibilitychange event is dispatched at the Document in a browsing context, cancel the pre-existing instance of the processing vibration patterns algorithm'> +<style> + button { + height: 100px; + width: 100px; + } +</style> + +<h1>Description</h1> +<p> + After hitting the button below, your device must vibrate for a short period of time (roughly one + second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then + the test has failed. +</p> +<button id='vib'>Vibrate!</button> +<script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> +<script> + var win; + + if (undefined !== navigator.vibrate) { + document.getElementById('vib').onclick = function () { + navigator.vibrate(5000); + setTimeout(function () { + win = window.open('about:blank', '_blank'); + setTimeout(function() { + win.close(); + }, 100); + }, 1000); + }; + } +</script> + diff --git a/testing/web-platform/tests/vibration/cancel-with-0-manual.html b/testing/web-platform/tests/vibration/cancel-with-0-manual.html new file mode 100644 index 000000000..6890d5764 --- /dev/null +++ b/testing/web-platform/tests/vibration/cancel-with-0-manual.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: cancel ongoing vibrate() with 0</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + <meta name='assert' content='If pattern is 0, cancel the pre-existing instance of the processing vibration patterns algorithm'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate for a short period of time (roughly one + second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then + the test has failed. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate(5000); + setTimeout(function () { + navigator.vibrate(0); + }, 1000); + }; + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/cancel-with-array-0-manual.html b/testing/web-platform/tests/vibration/cancel-with-array-0-manual.html new file mode 100644 index 000000000..60689cc2c --- /dev/null +++ b/testing/web-platform/tests/vibration/cancel-with-array-0-manual.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<meta charset='utf-8'> +<title>Vibration API: cancel ongoing vibrate() with [0]</title> +<link rel='author' title='Intel' href='http://www.intel.com'> +<link rel='help' href='http://dev.w3.org/2009/dap/vibration/#vibration-interface'> +<meta name='flags' content='interact'> +<meta name='assert' content='If pattern contains a single entry with a value of 0, cancel the pre-existing instance of the processing vibration patterns algorithm'> +<style> + button { + height: 100px; + width: 100px; + } +</style> + +<h1>Description</h1> +<p> + After hitting the button below, your device must vibrate for a short period of time (roughly one + second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then + the test has failed. +</p> +<button id='vib'>Vibrate!</button> +<script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> +<script> + if (undefined !== navigator.vibrate) { + document.getElementById('vib').onclick = function () { + navigator.vibrate(5000); + setTimeout(function () { + navigator.vibrate([0]); + }, 1000); + }; + } +</script> + diff --git a/testing/web-platform/tests/vibration/cancel-with-empty-array-manual.html b/testing/web-platform/tests/vibration/cancel-with-empty-array-manual.html new file mode 100644 index 000000000..9d4be2b3a --- /dev/null +++ b/testing/web-platform/tests/vibration/cancel-with-empty-array-manual.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: cancel ongoing vibrate() with []</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + <meta name='assert' content='If pattern is an empty list, cancel the pre-existing instance of the processing vibration patterns algorithm'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate for a short period of time (roughly one + second). If it vibrates for a longer time (roughly five seconds, it should feel somewhat long) then + the test has failed. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate(5000); + setTimeout(function () { + navigator.vibrate([]); + }, 1000); + }; + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/cancel-with-new-manual.html b/testing/web-platform/tests/vibration/cancel-with-new-manual.html new file mode 100644 index 000000000..1cd9daf17 --- /dev/null +++ b/testing/web-platform/tests/vibration/cancel-with-new-manual.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: cancel ongoing vibrate() with a new call to vibrate</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + <meta name='assert' content='Cancel the pre-existing instance of the processing vibration patterns algorithm, if any.'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate continuously for a short period of time (roughly one + second), then vibrate a series of short bursts. If the initial continuously vibration is longer (roughly five + seconds, it should feel somewhat long) or if there is no series of short vibration bursts then the test has + failed. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate(5000); + setTimeout(function () { + navigator.vibrate([200, 200, 200, 200, 200, 200, 200, 200, 200]); + }, 1000); + }; + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/idl.html b/testing/web-platform/tests/vibration/idl.html new file mode 100644 index 000000000..167090cd6 --- /dev/null +++ b/testing/web-platform/tests/vibration/idl.html @@ -0,0 +1,23 @@ +<!doctype html> +<meta charset=utf-8> +<title>IDL harness tests for Vibration API</title> +<body> + <h1>Description</h1> + <p> + This test validates the IDL defined by the Vibration API. + </p> + <p> + This test uses <a href="/resources/idlharness.js">idlharness.js</a> + </p> +<div id="log"></div> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=/resources/WebIDLParser.js></script> +<script src=/resources/idlharness.js></script> +<script> +var idl_array = new IdlArray(); +idl_array.add_untested_idls("interface Navigator {};"); +idl_array.add_idls("partial interface Navigator { boolean vibrate ((unsigned long or sequence<unsigned long>) pattern);};"); +idl_array.add_objects({Navigator: ['navigator']}); +idl_array.test(); +</script> diff --git a/testing/web-platform/tests/vibration/invalid-values.html b/testing/web-platform/tests/vibration/invalid-values.html new file mode 100644 index 000000000..a544ac23c --- /dev/null +++ b/testing/web-platform/tests/vibration/invalid-values.html @@ -0,0 +1,79 @@ +<!DOCTYPE html> +<meta charset='utf-8'> +<title>Vibration API: vibrate(invalid)</title> +<link rel='author' title='Intel' href='http://www.intel.com'> +<link rel='help' href='http://dev.w3.org/2009/dap/vibration/#vibration-interface'> + +<h1>Description</h1> +<p> + This test checks the <code>vibrate()</code> method with invalid parameter, + taking vendor prefixes into account. +</p> +<div id='log'></div> +<script src='/resources/testharness.js'></script> +<script src='/resources/testharnessreport.js'></script> +<script src='../support/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> +<script> + test(function() { + assert_throws(new TypeError(), function() { + navigator.vibrate(); + }, 'Argument is required, so was expecting a TypeError.'); + }, 'Missing pattern argument'); + + test(function() { + try { + navigator.vibrate(undefined); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of undefined resolves to []'); + + test(function() { + try { + navigator.vibrate(null); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of null resolves to []'); + + test(function() { + try { + navigator.vibrate('one'); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of empty string resolves to [""]'); + + test(function() { + try { + navigator.vibrate('one'); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of string resolves to ["one"]'); + + test(function() { + try { + navigator.vibrate(new String('one')); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of String instance resolves to ["one"]'); + + test(function() { + try { + navigator.vibrate(NaN); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of NaN resolves to [NaN]'); + + test(function() { + try { + navigator.vibrate({}); + } catch(e) { + assert_unreached('error message: ' + e.message); + } + }, 'pattern of {} resolves to [{}]'); +</script> + diff --git a/testing/web-platform/tests/vibration/pattern-array-extra-manual.html b/testing/web-platform/tests/vibration/pattern-array-extra-manual.html new file mode 100644 index 000000000..3f5ccf386 --- /dev/null +++ b/testing/web-platform/tests/vibration/pattern-array-extra-manual.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test a pattern array parameter to vibrate() with an extra (even) item</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + <meta name='assert' content='If the length of pattern is even, then remove the last entry in pattern.'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate three times for one second, separated + by one second intervals. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate([1000, 1000, 1000, 1000, 1000, 1000]); + }; + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/pattern-array-manual.html b/testing/web-platform/tests/vibration/pattern-array-manual.html new file mode 100644 index 000000000..43674bf8c --- /dev/null +++ b/testing/web-platform/tests/vibration/pattern-array-manual.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test a pattern array parameter to vibrate()</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate three times for one second, separated + by one second intervals. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate([1000, 1000, 1000, 1000, 1000]); + }; + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/pattern-array-with-0-manual.html b/testing/web-platform/tests/vibration/pattern-array-with-0-manual.html new file mode 100644 index 000000000..dff2f1ed7 --- /dev/null +++ b/testing/web-platform/tests/vibration/pattern-array-with-0-manual.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<meta charset='utf-8'> +<title>Vibration API: test a pattern array with 0ms vibration and still to vibrate()</title> +<link rel='author' title='Intel' href='http://www.intel.com'> +<link rel='help' href='http://dev.w3.org/2009/dap/vibration/#vibration-interface'> +<meta name='flags' content='interact'> +<style> + button { + height: 100px; + width: 100px; + } +</style> + +<h1>Description</h1> +<p> + After hitting the button below, your device must vibrate continuously for about two seconds, once. +</p> +<button id='vib'>Vibrate!</button> +<div id='log'></div> +<script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> +<script> + document.getElementById("vib").onclick = function () { + navigator.vibrate([0, 0, 2000]); + }; +</script> + diff --git a/testing/web-platform/tests/vibration/silent-ignore.html b/testing/web-platform/tests/vibration/silent-ignore.html new file mode 100644 index 000000000..c7447df51 --- /dev/null +++ b/testing/web-platform/tests/vibration/silent-ignore.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test that calls to vibrate() are silently ignored when the device cannot vibrate</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, no-vibrator'/> + <meta name='assert' content='If the device does not provide a vibration mechanism, or it is disabled, the user agent must silently ignore any invocations of the vibrate() method.'/> + </head> + <body> + <h1>Description</h1> + <p> + <strong>This test is only useful on devices that do not have vibration capability</strong>. + If your device supports vibration, then <strong>skip</strong> this test. An implementation + supporting this API but running on a device that cannot vibrate must silently ignore the + call (we test that it doesn't throw). + </p> + <div id='log'></div> + <script src='/resources/testharness.js'></script> + <script src='/resources/testharnessreport.js'></script> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + test(function () { + assert_true(navigator.vibrate(1000), "vibrate() returns true when vibration is not supported"); + }, "Calling vibrate returns true"); + } + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/simple-array-manual.html b/testing/web-platform/tests/vibration/simple-array-manual.html new file mode 100644 index 000000000..4a85bd6ad --- /dev/null +++ b/testing/web-platform/tests/vibration/simple-array-manual.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test a simple array parameter to vibrate()</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate continuously for about two seconds, once. + </p> + <button id='vib'>Vibrate!</button> + <div id='log'></div> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + document.getElementById("vib").onclick = function () { + navigator.vibrate([2000]); + }; + </script> + </body> +</html> diff --git a/testing/web-platform/tests/vibration/simple-scalar-manual.html b/testing/web-platform/tests/vibration/simple-scalar-manual.html new file mode 100644 index 000000000..0c7637bba --- /dev/null +++ b/testing/web-platform/tests/vibration/simple-scalar-manual.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset='utf-8'/> + <title>Vibration API: test a simple scalar parameter to vibrate()</title> + <link rel='author' title='Robin Berjon' href='mailto:robin@berjon.com'/> + <link rel='help' href='http://www.w3.org/TR/vibration/#methods'/> + <meta name='flags' content='dom, interact'/> + </head> + <body> + <h1>Description</h1> + <p> + After hitting the button below, your device must vibrate continuously for about two seconds, once. + </p> + <button id='vib'>Vibrate!</button> + <script src='/common/vendor-prefix.js' data-prefixed-objects='[{"ancestors":["navigator"], "name":"vibrate"}]'></script> + <script> + if (undefined !== navigator.vibrate) { + document.getElementById("vib").onclick = function () { + navigator.vibrate(2000); + }; + } + </script> + </body> +</html> |