OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/gc.js"></script> |
| 7 <script src="../resources/mojo-helpers.js"></script> |
| 8 <script src="resources/presentation-service-mock.js"></script> |
| 9 <button>click me</button> |
| 10 <script> |
| 11 |
| 12 function waitForClick(callback) { |
| 13 var button = document.querySelector('button'); |
| 14 button.addEventListener('click', callback, { once: true }); |
| 15 |
| 16 if (!('eventSender' in window)) |
| 17 return; |
| 18 |
| 19 var boundingRect = button.getBoundingClientRect(); |
| 20 var x = boundingRect.left + boundingRect.width / 2; |
| 21 var y = boundingRect.top + boundingRect.height / 2; |
| 22 |
| 23 eventSender.mouseMoveTo(x, y); |
| 24 eventSender.mouseDown(); |
| 25 eventSender.mouseUp(); |
| 26 } |
| 27 |
| 28 async_test(t => { |
| 29 presentationServiceMock.then(mockService => { |
| 30 var connection = null; |
| 31 var request = new PresentationRequest('https://example.com'); |
| 32 |
| 33 waitForClick(_ => { |
| 34 request.start().then(conn => { |
| 35 connection = conn; |
| 36 assert_not_equals(connection, null); |
| 37 |
| 38 request.reconnect(connection.id).then( |
| 39 t.step_func_done(conn => { |
| 40 assert_true(connection === conn); |
| 41 })); |
| 42 }); |
| 43 }); |
| 44 }); |
| 45 }, "Test that Presentation.reconnect() resolves with existing presentation conne
ction."); |
| 46 |
| 47 </script> |
| 48 </body> |
| 49 </html> |
OLD | NEW |