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

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: Add an assertion for state change to closed 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
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;
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_true(connection.state === 'connecting' ||
mark a. foltz 2017/01/18 20:30:17 Shouldn't state always be 'connecting' in the reso
takumif 2017/01/18 20:53:22 I wasn't sure because there was a browser test [1]
zhaobin 2017/01/20 19:27:50 Adding 'connected' state to fix crbug.com/664629
takumif 2017/01/23 19:58:12 Is the browser test still flaky after https://code
44 connection.state === 'connected');
45 })
46 );
47 });
48 connection.close();
49 });
50 });
51 });
52 }, "Test that Presentation.reconnect() resolves with a closed presentation conne ction and updates its state.");
mark a. foltz 2017/01/18 20:30:17 s/closed/connecting/
takumif 2017/01/18 20:53:22 I wanted to say that the connection given is the o
53
54 </script>
55 </body>
56 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698