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

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/presentation-controller-connection-closed-by-receiver.html

Issue 2730123003: [Presentation API] Add layout test for connection.close() and fix test failures (Closed)
Patch Set: 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/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>
9 <script>
10
11 var button = document.querySelector('button');
12 var controllerConnectionClosed = false;
13
14 async_test(t => {
15 presentationServiceMock.then(service => {
16 // This is receiving the user gesture and runs the callback.
17 waitForClick(() => {
18 new PresentationRequest("http://example.com/").start().then(
19 connection => {
20 connection.onclose = () => {
21 assert_equals(connection.state, "closed");
22 controllerConnectionClosed = true;
23 };
24 connection.onconnect = () => {
25 // Open a receiver page and pass controller connection's
26 // controllerConnectionPtr and receiverConnectionRequest to it.
27 w = window.open("resources/presentation-receiver-close-connection.ht ml");
28 w.controllerConnectionPtr = service.getControllerConnectionPtr();
29 w.receiverConnectionRequest = service.getReceiverConnectionRequest() ;
30 w.shouldCallClose = true;
31 };
32 });
33 }, button);
34 });
35
36 window.addEventListener("message", t.step_func(e => {
37 if (e.data == "receiver connection closed") {
38 assert_true(controllerConnectionClosed);
39 t.done();
40 }
41 }));
42 }, "receiver connection.close() should fire both controller's and receiver's onc lose event handler");
43
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698