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

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

Issue 2552343009: [Presentation API] Adds DOMString[] constructor to PresentationRequest. (Closed)
Patch Set: resolve code review comments from foolip 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
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/gc.js"></script> 6 <script src="../resources/gc.js"></script>
7 <script src="../resources/mojo-helpers.js"></script> 7 <script src="../resources/mojo-helpers.js"></script>
8 <script src="resources/presentation-service-mock.js"></script> 8 <script src="resources/presentation-service-mock.js"></script>
9 <button>click me</button> 9 <button>click me</button>
10 <script> 10 <script>
11 11
12 function waitForClick(callback) {
13 var button = document.querySelector('button');
14 button.addEventListener('click', callback, { once: true });
15
16 if (!('eventSender' in window))
17 return;
18
19 var boundingRect = button.getBoundingClientRect();
20 var x = boundingRect.left + boundingRect.width / 2;
21 var y = boundingRect.top + boundingRect.height / 2;
22
23 eventSender.mouseMoveTo(x, y);
24 eventSender.mouseDown();
25 eventSender.mouseUp();
26 }
27
28 async_test(t => { 12 async_test(t => {
29 presentationServiceMock.then(mockService => { 13 presentationServiceMock.then(mockService => {
14 var button = document.querySelector('button');
30 var connection = null; 15 var connection = null;
31 var request = new PresentationRequest('https://example.com'); 16 var request = new PresentationRequest('https://example.com');
32 17
33 waitForClick(_ => { 18 waitForClick(_ => {
34 request.start().then(conn => { 19 request.start().then(conn => {
35 connection = conn; 20 connection = conn;
36 assert_not_equals(connection, null); 21 assert_not_equals(connection, null);
37 22
38 request.reconnect(connection.id).then( 23 request.reconnect(connection.id).then(
39 t.step_func_done(conn => { 24 t.step_func_done(conn => {
40 assert_true(connection === conn); 25 assert_true(connection === conn);
41 })); 26 }));
42 }); 27 });
43 }); 28 }, button);
44 }); 29 });
45 }, "Test that Presentation.reconnect() resolves with existing presentation conne ction."); 30 }, "Test that Presentation.reconnect() resolves with existing presentation conne ction.");
46 31
47 </script> 32 </script>
48 </body> 33 </body>
49 </html> 34 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698