blob: 240ee67f2394cd8f35147a9b00b2676adb298866 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/third_party/WebKit/public/platform/modules/presentation/presentation.mojom.js"></script>
<script src="presentation-service-mock.js"></script>
<script>
// Parent window sets parameter for this page.
assert_not_equals(controllerConnectionPtr, null);
assert_not_equals(receiverConnectionRequest, null);
internals.settings.setPresentationReceiver(true);
var connection = null;
const pageUrl = 'http://example.com/a.html';
const id = 'fakeSessionId';
presentationServiceMock.onSetClient = () => {
presentationServiceMock.onReceiverConnectionAvailable(
pageUrl, id, controllerConnectionPtr, receiverConnectionRequest);
};
navigator.presentation.receiver.connectionList.then(list => {
assert_equals(list.connections.length, 1);
connection = list.connections[0];
connection.terminate();
});
window.onunload = () => {
if (connection.state == 'terminated') {
opener.postMessage('passed', '*');
} else {
opener.postMessage('failed', '*');
}
internals.settings.setPresentationReceiver(false);
};
</script>
</body>
</html>