| Index: third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
|
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html b/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
|
| index 55077a988f631c5c7b6cb7f3de4ae702909969db..3d462d477c7eaca1af42ee093386dda59fda77f9 100644
|
| --- a/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
|
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
|
| @@ -3,13 +3,40 @@
|
| <body>
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| +<script src="../resources/mojo-helpers.js"></script>
|
| +<script src="resources/presentation-service-mock.js"></script>
|
| +<button>click me</button>
|
| <script>
|
|
|
| +var button = document.querySelector('button');
|
| +var controllerConnectionTerminated = false;
|
| +
|
| async_test(t => {
|
| - const w = window.open("resources/presentation-receiver-postmessage.html");
|
| + presentationServiceMock.then(service => {
|
| + // This is receiving the user gesture and runs the callback.
|
| + waitForClick(() => {
|
| + new PresentationRequest("https://example.com/").start().then(
|
| + connection => {
|
| + connection.onterminate = () => {
|
| + assert_equals(connection.state, "terminated");
|
| + controllerConnectionTerminated = true;
|
| + };
|
| + connection.onconnect = () => {
|
| + // Open a receiver page and pass controller connection's
|
| + // controllerConnectionPtr and receiverConnectionRequest to it.
|
| + var w = window.open(
|
| + "resources/presentation-receiver-postmessage.html");
|
| + w.controllerConnectionPtr = service.getControllerConnectionPtr();
|
| + w.receiverConnectionRequest = service.getReceiverConnectionRequest();
|
| + };
|
| + });
|
| + }, button);
|
| + });
|
| +
|
| window.addEventListener("message", t.step_func(e => {
|
| if (e.data == "passed" || e.data == "failed") {
|
| assert_equals("passed", e.data, "Receiver connection is terminated!");
|
| + assert_true(controllerConnectionTerminated);
|
| t.done();
|
| }
|
| }));
|
|
|