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

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 a layout test 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_true(connection.state === 'connecting');
37
38 connection.onclose = (_ => {
39 request.reconnect(connection.id).then(
40 t.step_func_done(conn => {
41 assert_true(connection === conn);
42 assert_true(connection.state === 'connecting' ||
43 connection.state === 'connected');
44 })
45 );
46 });
47 connection.close();
zhaobin 2017/01/18 19:46:52 assert_true(connection.state === 'closed'); ?
takumif 2017/01/18 19:57:26 Added the check to the onclose callback, as the st
48 });
49 });
50 });
51 }, "Test that Presentation.reconnect() resolves with a closed presentation conne ction and updates its state.");
52
53 </script>
54 </body>
55 </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