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

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

Issue 2863903002: [Presentation API] Change controller connection to 'terminated' when receiver connection terminates (Closed)
Patch Set: fix layout test failures Created 3 years, 7 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../../resources/testharness.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/mojo-helpers.js"></script> 5 <script src="../../resources/mojo-helpers.js"></script>
6 <script src="presentation-service-mock.js"></script> 6 <script src="presentation-service-mock.js"></script>
7 <script> 7 <script>
8 8
9 // Parent window sets parameter for this page.
10 assert_not_equals(controllerConnectionPtr, null);
11 assert_not_equals(receiverConnectionRequest, null);
12
9 internals.settings.setPresentationReceiver(true); 13 internals.settings.setPresentationReceiver(true);
10 14
11 var connection = null; 15 var connection = null;
12 16
13 presentationServiceMock.then(mockService => { 17 presentationServiceMock.then(mockService => {
14 const url = 'http://example.com/a.html'; 18 const url = 'http://example.com/a.html';
15 const id = 'fakeSessionId'; 19 const id = 'fakeSessionId';
16 20
17 mockService.onSetClient = () => { 21 mockService.onSetClient = () => {
18 mockService.onReceiverConnectionAvailable(url, id); 22 mockService.onReceiverConnectionAvailable(
23 url, id, controllerConnectionPtr, receiverConnectionRequest);
19 }; 24 };
20 25
21 navigator.presentation.receiver.connectionList.then(list => { 26 navigator.presentation.receiver.connectionList.then(list => {
22 assert_equals(list.connections.length, 1); 27 assert_equals(list.connections.length, 1);
23 connection = list.connections[0]; 28 connection = list.connections[0];
24 connection.terminate(); 29 connection.terminate();
25 }); 30 });
26 }); 31 });
27 32
28 window.onunload = () => { 33 window.onunload = () => {
29 if (connection.state == 'terminated') { 34 if (connection.state == 'terminated') {
30 opener.postMessage('passed', '*'); 35 opener.postMessage('passed', '*');
31 } else { 36 } else {
32 opener.postMessage('failed', '*'); 37 opener.postMessage('failed', '*');
33 } 38 }
34 internals.settings.setPresentationReceiver(false); 39 internals.settings.setPresentationReceiver(false);
35 }; 40 };
36 41
37 </script> 42 </script>
38 </body> 43 </body>
39 </html> 44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698