Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions vibration/TODO.txt

This file was deleted.

38 changes: 38 additions & 0 deletions vibration/cancel-when-hidden-manual.html
Original file line number Diff line number Diff line change
@@ -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>

33 changes: 33 additions & 0 deletions vibration/cancel-with-array-0-manual.html
Original file line number Diff line number Diff line change
@@ -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>

79 changes: 79 additions & 0 deletions vibration/invalid-values.html
Original file line number Diff line number Diff line change
@@ -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>