Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,28 @@
<!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.'/>
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
</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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -0,0 +1,32 @@
<!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.'/>
<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
</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>

View file

@ -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>

View file

@ -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>