tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

reconnectToPresentation_notfound_error-manual.https.html (2596B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Calling "reconnect" with a wrong presentation ID fails with a NotFoundError exception</title>
      4 <link rel="author" title="Franck William Taffo" href="http://www.fokus.fraunhofer.de">
      5 <link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
      6 <link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
      7 <link rel="help" href="http://w3c.github.io/presentation-api/#dom-presentationrequest-reconnect">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="common.js"></script>
     11 
     12 <p>Click the button below to start the manual test. Select a presentation device after the selection dialog is prompted.
     13  The test assumes that at least one presentation device is available. The test passes if a "PASS" result appears.</p>
     14 <button id="startBtn">Start Test</button>
     15 
     16 <script>
     17  promise_test(async t => {
     18    const startBtn = document.getElementById('startBtn');
     19    const wrongPresentationId = "wrongPresentationId";
     20    const request1 = new PresentationRequest(presentationUrls);
     21    const request2 = new PresentationRequest('https://www.w3.org');
     22    let connection1, eventWatcher1;
     23 
     24    t.add_cleanup(() => {
     25      if (connection1) {
     26        connection1.onconnect = () => { connection1.terminate(); }
     27        if (connection1.state === 'closed')
     28          request1.reconnect(connection1.id);
     29        else
     30          connection1.terminate();
     31      }
     32    });
     33 
     34    await promise_rejects_dom(t, 'NotFoundError', request1.reconnect(wrongPresentationId),
     35      'Reconnecting with an unknown presentation ID fails with a NotFoundError exception.');
     36 
     37    setup({explicit_timeout: true});
     38    const clickWatcher = new EventWatcher(t, startBtn, 'click');
     39    await clickWatcher.wait_for('click');
     40    connection1 = await request1.start();
     41 
     42    t.step_timeout(() => {
     43      t.force_timeout();
     44      t.done();
     45    }, 5000);
     46 
     47    startBtn.disabled = true;
     48    eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
     49    await eventWatcher1.wait_for('connect');
     50    connection1.close();
     51    await eventWatcher1.wait_for('close');
     52 
     53    await promise_rejects_dom(t, 'NotFoundError', request2.reconnect(connection1.id),
     54      'Reconnecting with a presentation ID on a presentation request with a different URL fails with a NotFoundError exception.');
     55 
     56    await request1.reconnect(connection1.id);
     57    await eventWatcher1.wait_for('connect');
     58    connection1.terminate();
     59    await eventWatcher1.wait_for('terminate');
     60  });
     61 </script>