| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>Reconnect to presentation success manual test</title> |
| <link rel="author" title="Marius Wessel" 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> |
| |
| <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> |
| // disable timeout for manual tests |
| setup({explicit_timeout: true}); |
| var startBtn = document.getElementById("startBtn"); |
| startBtn.onclick = function () { |
| startBtn.disabled = true; |
| promise_test(function (t) { |
| var request = new PresentationRequest(presentationUrls); |
| var presentationId = null; |
| var connection; |
| |
| t.add_cleanup(function() { |
| if(connection) |
| connection.terminate(); |
| }); |
| |
| return request.start().then(function (c) { |
| connection = c; |
| presentationId = connection.id; |
| |
| // No more user input needed, re-enable test timeout |
| t.step_timeout(function () { |
| t.force_timeout(); |
| t.done(); |
| }, 5000); |
| // Close connection and wait for "close" event |
| connection.close(); |
| var eventWatcher = new EventWatcher(t, connection, 'close'); |
| return eventWatcher.wait_for('close'); |
| }).then(function () { |
| // Connection now closed, let's reconnect to it |
| return request.reconnect(presentationId); |
| }).then(function (c) { |
| connection = c; |
| assert_equals(connection.state, "connecting", "connection should be in 'connecting' state"); |
| assert_equals(connection.id, presentationId, "Ids of old and new connections must be equal"); |
| }); |
| }); |
| }; |
| </script> |