mirror of
https://github.com/servo/servo.git
synced 2025-08-24 14:48:21 +01:00
Update web-platform-tests to revision 1aaada4bbc936024441fe7995b77c21a2c554da1
This commit is contained in:
parent
1e1eca07ed
commit
5e9d150c07
140 changed files with 3413 additions and 553 deletions
|
@ -0,0 +1,120 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Reconnecting presentations on two distinct displays</title>
|
||||
<link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<style>
|
||||
#second-step {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p id="first-step">Click the button below and select the available presentation display, to start the manual test.</p>
|
||||
<p id="second-step">Click the button below and select the other available presentation display, to continue the manual test.</p>
|
||||
<p>This test asks you to click the button twice, unless the test fails.<br>
|
||||
<em>This test requires two or more available displays.<em></p>
|
||||
<button id="presentBtn">Start Presentation Test</button>
|
||||
|
||||
|
||||
<script>
|
||||
promise_test(async t => {
|
||||
const presentBtn = document.getElementById("presentBtn");
|
||||
|
||||
const request1 = new PresentationRequest(presentationUrls);
|
||||
const request2 = new PresentationRequest(presentationUrls);
|
||||
const clickWatcher = new EventWatcher(t, presentBtn, 'click');
|
||||
let connection1, connection2, eventWatcher1, eventWatcher2, timer;
|
||||
|
||||
t.add_cleanup(() => {
|
||||
[
|
||||
{ connection: connection1, request: request1 },
|
||||
{ connection: connection2, request: request2 }
|
||||
].forEach(p => {
|
||||
if (p.connection) {
|
||||
p.connection.onconnect = () => { p.connection.terminate(); };
|
||||
if (p.connection.state == 'closed')
|
||||
p.request.reconnect(p.connection.id);
|
||||
else
|
||||
p.connection.terminate();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const disableTimeout = () => {
|
||||
setup({explicit_timeout: true});
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const enableTimeout = () => {
|
||||
timer = t.step_timeout(() => {
|
||||
t.force_timeout();
|
||||
t.done();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
disableTimeout();
|
||||
|
||||
await clickWatcher.wait_for('click');
|
||||
presentBtn.disabled = true;
|
||||
connection1 = await request1.start();
|
||||
|
||||
presentBtn.disabled = false;
|
||||
document.getElementById('first-step').style.display = 'none';
|
||||
document.getElementById('second-step').style.display = 'block';
|
||||
presentBtn.innerText = 'Continue Presentation Test';
|
||||
eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
|
||||
|
||||
await Promise.all([
|
||||
eventWatcher1.wait_for('connect'),
|
||||
(async () => {
|
||||
await clickWatcher.wait_for('click');
|
||||
presentBtn.disabled = true;
|
||||
|
||||
connection2 = await request2.start();
|
||||
enableTimeout();
|
||||
eventWatcher2 = new EventWatcher(t, connection2, ['connect', 'close', 'terminate']);
|
||||
await eventWatcher2.wait_for('connect');
|
||||
})()
|
||||
]);
|
||||
|
||||
connection1.close();
|
||||
assert_equals(connection2.state, 'connected',
|
||||
'Closing one presentation connection does not affect the state of the other.');
|
||||
|
||||
await eventWatcher1.wait_for('close');
|
||||
assert_equals(connection1.state, 'closed', 'The presentation connection is successfully closed.');
|
||||
|
||||
connection2.close();
|
||||
await eventWatcher2.wait_for('close');
|
||||
assert_equals(connection2.state, 'closed', 'The presentation connection is successfully closed.');
|
||||
|
||||
const c1 = await request1.reconnect(connection1.id);
|
||||
assert_equals(c1, connection1, 'The promise is resolved with the existing presentation connection.');
|
||||
|
||||
// Reconnecting a presentation via a different presentation request with the same presentation
|
||||
// URLs will succeed
|
||||
const c2 = await request1.reconnect(connection2.id);
|
||||
assert_equals(c2, connection2, 'The promise is resolved with the existing presentation connection.');
|
||||
|
||||
await Promise.all([
|
||||
eventWatcher1.wait_for('connect'),
|
||||
eventWatcher2.wait_for('connect')
|
||||
]);
|
||||
|
||||
assert_equals(connection1.state, 'connected', 'The presentation connection is successfully reconnected.');
|
||||
assert_equals(connection2.state, 'connected', 'The presentation connection is successfully reconnected.');
|
||||
connection1.terminate();
|
||||
connection2.terminate();
|
||||
|
||||
await Promise.all([
|
||||
eventWatcher1.wait_for('terminate'),
|
||||
eventWatcher2.wait_for('terminate')
|
||||
]);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "reconnect" with a wrong presentation ID fails with a NotFoundError exception</title>
|
||||
<link rel="author" title="Franck William Taffo" href="http://www.fokus.fraunhofer.de">
|
||||
<link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
|
||||
<link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="common.js"></script>
|
||||
|
||||
<p>Click the button below to start the manual test. Select a presentation device after the selection dialog is prompted.
|
||||
The test assumes that at least one presentation device is available. The test passes if a "PASS" result appears.</p>
|
||||
<button id="startBtn">Start Test</button>
|
||||
|
||||
<script>
|
||||
promise_test(async t => {
|
||||
const startBtn = document.getElementById('startBtn');
|
||||
const wrongPresentationId = "wrongPresentationId";
|
||||
const request1 = new PresentationRequest(presentationUrls);
|
||||
const request2 = new PresentationRequest('https://www.w3.org');
|
||||
let connection1, eventWatcher1;
|
||||
|
||||
t.add_cleanup(() => {
|
||||
if (connection1) {
|
||||
connection1.onconnect = () => { connection1.terminate(); }
|
||||
if (connection1.state === 'closed')
|
||||
request1.reconnect(connection1.id);
|
||||
else
|
||||
connection1.terminate();
|
||||
}
|
||||
});
|
||||
|
||||
await promise_rejects(t, 'NotFoundError', request1.reconnect(wrongPresentationId),
|
||||
'Reconnecting with an unknown presentation ID fails with a NotFoundError exception.');
|
||||
|
||||
setup({explicit_timeout: true});
|
||||
const clickWatcher = new EventWatcher(t, startBtn, 'click');
|
||||
await clickWatcher.wait_for('click');
|
||||
connection1 = await request1.start();
|
||||
|
||||
t.step_timeout(() => {
|
||||
t.force_timeout();
|
||||
t.done();
|
||||
}, 5000);
|
||||
|
||||
startBtn.disabled = true;
|
||||
eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
|
||||
await eventWatcher1.wait_for('connect');
|
||||
connection1.close();
|
||||
await eventWatcher1.wait_for('close');
|
||||
|
||||
await promise_rejects(t, 'NotFoundError', request2.reconnect(connection1.id),
|
||||
'Reconnecting with a presentation ID on a presentation request with a different URL fails with a NotFoundError exception.');
|
||||
|
||||
await request1.reconnect(connection1.id);
|
||||
await eventWatcher1.wait_for('connect');
|
||||
connection1.terminate();
|
||||
await eventWatcher1.wait_for('terminate');
|
||||
});
|
||||
</script>
|
|
@ -1,16 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Calling "reconnect" with an unknown presentation ID fails with a NotFoundError exception</title>
|
||||
<link rel="author" title="Franck William Taffo" href="http://www.fokus.fraunhofer.de">
|
||||
<link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<script>
|
||||
promise_test(function (t) {
|
||||
var wrongPresentationId = "wrongPresentationId";
|
||||
var request = new PresentationRequest(presentationUrls);
|
||||
return promise_rejects(t, 'NotFoundError', request.reconnect(wrongPresentationId));
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Starting presentations on two distinct displays</title>
|
||||
<link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
|
||||
<link rel="help" href="http://w3c.github.io/presentation-api/#dfn-controlling-user-agent">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<style>
|
||||
#second-step {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p id="first-step">Click the button below and select the available presentation display, to start the manual test.</p>
|
||||
<p id="second-step">Click the button below and select the other available presentation display, to continue the manual test.</p>
|
||||
<p>This test asks you to click the button twice, unless the test fails.<br>
|
||||
<em>This test requires two or more available displays.<em></p>
|
||||
<button id="presentBtn">Start Presentation Test</button>
|
||||
|
||||
|
||||
<script>
|
||||
promise_test(async t => {
|
||||
const presentBtn = document.getElementById("presentBtn");
|
||||
|
||||
const request = new PresentationRequest(presentationUrls);
|
||||
const clickWatcher = new EventWatcher(t, presentBtn, 'click');
|
||||
let connection1, connection2, eventWatcher1, eventWatcher2, timer;
|
||||
|
||||
t.add_cleanup(() => {
|
||||
[connection1, connection2].forEach(connection => {
|
||||
if (connection) {
|
||||
connection.onconnect = () => { connection.terminate(); };
|
||||
if (connection.state == 'closed')
|
||||
request.reconnect(connection.id);
|
||||
else
|
||||
connection.terminate();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const disableTimeout = () => {
|
||||
setup({explicit_timeout: true});
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const enableTimeout = () => {
|
||||
timer = t.step_timeout(() => {
|
||||
t.force_timeout();
|
||||
t.done();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
disableTimeout();
|
||||
|
||||
await clickWatcher.wait_for('click');
|
||||
presentBtn.disabled = true;
|
||||
connection1 = await request.start();
|
||||
|
||||
presentBtn.disabled = false;
|
||||
document.getElementById('first-step').style.display = 'none';
|
||||
document.getElementById('second-step').style.display = 'block';
|
||||
presentBtn.innerText = 'Continue Presentation Test';
|
||||
eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
|
||||
|
||||
await Promise.all([
|
||||
eventWatcher1.wait_for('connect'),
|
||||
(async () => {
|
||||
await clickWatcher.wait_for('click');
|
||||
presentBtn.disabled = true;
|
||||
|
||||
connection2 = await request.start();
|
||||
enableTimeout();
|
||||
eventWatcher2 = new EventWatcher(t, connection2, ['connect', 'terminate']);
|
||||
await eventWatcher2.wait_for('connect');
|
||||
})()
|
||||
]);
|
||||
|
||||
assert_not_equals(connection1.id, connection2.id,
|
||||
'Presentation connections on distinct presentations must have different presentation IDs.');
|
||||
|
||||
assert_equals(connection1.state, 'connected', 'The presentation connection is successfully reconnected.');
|
||||
connection1.terminate();
|
||||
assert_equals(connection2.state, 'connected',
|
||||
'Terminating one presentation connection does not affect the state of the other.');
|
||||
connection2.terminate();
|
||||
|
||||
await Promise.all([
|
||||
eventWatcher1.wait_for('terminate'),
|
||||
eventWatcher2.wait_for('terminate')
|
||||
]);
|
||||
|
||||
assert_equals(connection1.state, 'terminated', 'One presentation connection is successfully terminated.');
|
||||
assert_equals(connection2.state, 'terminated', 'Both presentation connections are successfully terminated.');
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue