| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/mojo-helpers.js"></script> |
| 6 <script src="presentation-service-mock.js"></script> |
| 7 <script> |
| 8 |
| 9 // Parent window sets parameter for this page. |
| 10 assert_not_equals(controllerConnectionPtr, null); |
| 11 assert_not_equals(receiverConnectionRequest, null); |
| 12 assert_not_equals(shouldCallClose, null); |
| 13 |
| 14 internals.settings.setPresentationReceiver(true); |
| 15 |
| 16 presentationServiceMock.then(mockService => { |
| 17 const url = 'http://example.com/a.html'; |
| 18 const id = 'fakeSessionId'; |
| 19 |
| 20 mockService.onSetClient = () => { |
| 21 mockService.onReceiverConnectionAvailable( |
| 22 url, id, controllerConnectionPtr, receiverConnectionRequest); |
| 23 }; |
| 24 |
| 25 navigator.presentation.receiver.connectionList.then(list => { |
| 26 assert_equals(list.connections.length, 1); |
| 27 const connection = list.connections[0]; |
| 28 connection.onclose = () => { |
| 29 assert_equals(connection.state, 'closed'); |
| 30 opener.postMessage('receiver connection closed', '*'); |
| 31 }; |
| 32 opener.postMessage('receiver connection ready', '*'); |
| 33 if (shouldCallClose) { |
| 34 connection.close(); |
| 35 } |
| 36 }); |
| 37 }); |
| 38 |
| 39 window.onunload = () => { |
| 40 internals.settings.setPresentationReceiver(false); |
| 41 }; |
| 42 |
| 43 </script> |
| 44 </body> |
| 45 </html> |
| OLD | NEW |