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

Side by Side Diff: third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Address Mark's comments Created 3 years, 11 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 function waitForClick(callback) {
mark a. foltz 2017/01/20 18:48:22 waitForClick() is already defined in presentation-
takumif 2017/01/23 19:58:12 Removed.
12 var button = document.querySelector('button');
13 button.addEventListener('click', callback, { once: true });
14
15 if (!('eventSender' in window))
16 return;
17
18 var boundingRect = button.getBoundingClientRect();
19 var x = boundingRect.left + boundingRect.width / 2;
20 var y = boundingRect.top + boundingRect.height / 2;
21
22 eventSender.mouseMoveTo(x, y);
23 eventSender.mouseDown();
24 eventSender.mouseUp();
25 }
26
27 async_test(t => {
28 presentationServiceMock.then(mockService => {
29 var connection = null;
mark a. foltz 2017/01/20 18:48:22 I would prefer to use const/let in these tests, bu
takumif 2017/01/23 19:58:12 Changed all the files in this directory to use con
30 var request = new PresentationRequest('https://example.com');
31
32 waitForClick(_ => {
33 request.start().then(conn => {
34 connection = conn;
35 assert_not_equals(connection, null);
36 assert_equals(connection.state, 'connecting');
37
38 connection.onclose = (_ => {
39 assert_equals(connection.state, 'closed');
40 request.reconnect(connection.id).then(
41 t.step_func_done(conn => {
42 assert_equals(connection, conn);
43 assert_equals(connection.state, 'connecting');
44 })
45 );
46 });
47 connection.close();
48 });
49 });
50 });
51 }, "Test that Presentation.reconnect() resolves with a previously closed present ation connection, whose state is updated to 'connecting.'");
52
53 </script>
54 </body>
55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698