blob: 41cb360bb1d330181652e9a38eeb2b21cc5ad634 [file] [log] [blame]
<!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="">
<link rel="author" title="Louay Bassbouss" href="">
<link rel="author" title="Tomoyuki Shimizu" href="">
<link rel="help" href="">
<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>
promise_test(async t => {
const startBtn = document.getElementById('startBtn');
const wrongPresentationId = "wrongPresentationId";
const request1 = new PresentationRequest(presentationUrls);
const request2 = new PresentationRequest('');
let connection1, eventWatcher1;
t.add_cleanup(() => {
if (connection1) {
connection1.onconnect = () => { connection1.terminate(); }
if (connection1.state === 'closed')
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(() => {
}, 5000);
startBtn.disabled = true;
eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
await eventWatcher1.wait_for('connect');
await eventWatcher1.wait_for('close');
await promise_rejects(t, 'NotFoundError', request2.reconnect(,
'Reconnecting with a presentation ID on a presentation request with a different URL fails with a NotFoundError exception.');
await request1.reconnect(;
await eventWatcher1.wait_for('connect');
await eventWatcher1.wait_for('terminate');