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

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.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/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <script src="../resources/mojo-helpers.js"></script>
7 <script src="resources/presentation-service-mock.js"></script>
8 <button>click me</button>
6 <script> 9 <script>
7 10
11 var button = document.querySelector('button');
12 var controllerConnectionTerminated = false;
13
8 async_test(t => { 14 async_test(t => {
9 const w = window.open("resources/presentation-receiver-postmessage.html"); 15 presentationServiceMock.then(service => {
16 // This is receiving the user gesture and runs the callback.
17 waitForClick(() => {
18 new PresentationRequest("https://example.com/").start().then(
19 connection => {
20 connection.onterminate = () => {
21 assert_equals(connection.state, "terminated");
22 controllerConnectionTerminated = true;
23 };
24 connection.onconnect = () => {
25 // Open a receiver page and pass controller connection's
26 // controllerConnectionPtr and receiverConnectionRequest to it.
27 var w = window.open(
28 "resources/presentation-receiver-postmessage.html");
29 w.controllerConnectionPtr = service.getControllerConnectionPtr();
30 w.receiverConnectionRequest = service.getReceiverConnectionRequest() ;
31 };
32 });
33 }, button);
34 });
35
10 window.addEventListener("message", t.step_func(e => { 36 window.addEventListener("message", t.step_func(e => {
11 if (e.data == "passed" || e.data == "failed") { 37 if (e.data == "passed" || e.data == "failed") {
12 assert_equals("passed", e.data, "Receiver connection is terminated!"); 38 assert_equals("passed", e.data, "Receiver connection is terminated!");
39 assert_true(controllerConnectionTerminated);
13 t.done(); 40 t.done();
14 } 41 }
15 })); 42 }));
16 }, "receiver connection.terminate() should close receiver frame"); 43 }, "receiver connection.terminate() should close receiver frame");
17 44
18 </script> 45 </script>
19 </body> 46 </body>
20 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698