| 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/mojo-helpers.js"></script> |
| 7 <script src="resources/presentation-service-mock.js"></script> |
| 8 <script> |
| 9 |
| 10 async_test(t => { |
| 11 internals.settings.setPresentationReceiver(true); |
| 12 t.add_cleanup(_ => { internals.settings.setPresentationReceiver(false); }); |
| 13 |
| 14 presentationServiceMock.then(mockService => { |
| 15 // Invoke mockService.setClient(). |
| 16 const receiver = navigator.presentation.receiver; |
| 17 |
| 18 // Make sure it is invoked after calling setClient(). |
| 19 setTimeout(() => { |
| 20 const url = 'http://example.com/a.html'; |
| 21 const id = 'fakeSessionId'; |
| 22 mockService.onReceiverConnectionAvailable(url, id); |
| 23 |
| 24 receiver.connectionList.then( |
| 25 t.step_func_done(list => { |
| 26 assert_equals(list.connections.length, 1); |
| 27 assert_equals(list.connections[0].url, url); |
| 28 assert_equals(list.connections[0].id, id); |
| 29 })); |
| 30 }); |
| 31 }); |
| 32 }, "Test presentation.receiver.connectionList resolves with incoming connection.
"); |
| 33 |
| 34 </script> |
| 35 </body> |
| 36 </html> |
| OLD | NEW |