Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html

Issue 2730123003: [Presentation API] Add layout test for connection.close() and fix test failures (Closed)
Patch Set: remove unnecessary forward declarations Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698