Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534

Fixes #15648.
This commit is contained in:
Ms2ger 2017-02-20 11:44:42 +01:00
parent a1e4c547f0
commit 4fadf9b0b6
1184 changed files with 22551 additions and 9856 deletions

View file

@ -0,0 +1,19 @@
# Remote Playback API specification Tests
The Remote Playback API can be found here:
GitHub repository: https://github.com/w3c/remote-playback/
File an issue: https://github.com/w3c/remote-playback/issues/new
## Hardware/network dependency
The Remote Playback API requires to communicate with a device over the network.
Some behavior would require a real devices to be implemented. In order to keep
these tests automated, only behaviors that can be run without user gesture or
specific configurations are available here.
## TODO
Some tests are missing, including, but not only:
* IDL tests

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<title>Tests various ways to call cancelWatchAvailability()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
async_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('movie_5');
v.remote.watchAvailability(function() {})
.then(t.step_func(id => {
v.remote.cancelWatchAvailability(id).then(t.step_func(function() {
v.remote.cancelWatchAvailability(id).then(
t.unreached_func(), t.step_func_done(e => {
assert_equals(e.name, 'NotFoundError');
})
);
}), t.unreached_func());
}), t.unreached_func());
}, 'Test that calling cancelWatchAvailability() with an id does remove the callback.');
async_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('media_5');
Promise.all([
v.remote.watchAvailability(function() {}),
v.remote.watchAvailability(function() {})
]).then(t.step_func(ids => {
v.remote.cancelWatchAvailability().then(t.step_func(function() {
v.remote.cancelWatchAvailability(ids[0]).then(t.unreached_func(), t.step_func(function(e) {
assert_equals(e.name, 'NotFoundError');
v.remote.cancelWatchAvailability(ids[1])
.then(t.unreached_func(), t.step_func_done(function(e) {
assert_equals(e.name, 'NotFoundError');
}));
}));
}), t.unreached_func());
}), t.unreached_func());
}, 'Test that calling cancelWatchAvailability() without an id removes all the callbacks.');
</script>
</html>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<title>Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws an exception</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
async_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('movie_5');
v.remote.watchAvailability(function() {})
.then(id => {
v.disableRemotePlayback = true;
v.remote.cancelWatchAvailability(id).then(
t.unreached_func(),
t.step_func(e => {
assert_equals(e.name, 'InvalidStateError');
v.remote.cancelWatchAvailability().then(
t.unreached_func(),
t.step_func_done(e => {
assert_equals(e.name, 'InvalidStateError');
})
);
}));
}, t.unreached_func());
}, 'Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws an exception.');
</script>
</html>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<title>Test that calling prompt() when disableRemotePlayback attribute is set throws an exception</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
promise_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('movie_5');
v.disableRemotePlayback = true;
return promise_rejects(t, 'InvalidStateError', v.remote.prompt());
}, 'Test that calling prompt() when disableRemotePlayback attribute is set throws an exception.');
</script>
</html>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<title>Test that calling watchAvailability() when disableRemotePlayback attribute is set throws an exception</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
promise_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('movie_5');
v.disableRemotePlayback = true;
return promise_rejects(t, 'InvalidStateError',
v.remote.watchAvailability(function() {}));
}, 'Test that calling watchAvailability() when disableRemotePlayback attribute is set throws an exception.');
</script>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<title>Test that the callback is called once watchAvailability() resolves.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
async_test(t => {
var v = document.createElement('video');
v.src = getVideoURI('movie_5');
var promiseResolved = false;
function callback(available) {
assert_true(promiseResolved);
}
v.remote.watchAvailability(t.step_func_done(callback)).then(
t.step_func(() => { promiseResolved = true; }), t.unreached_func());
}, 'Test that the callback is called once watchAvailability() resolves.');
</script>
</html>