| OLD | NEW |
| (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 async_test(t => { | |
| 12 presentationServiceMock.then(mockService => { | |
| 13 const button = document.querySelector('button'); | |
| 14 let connection = null; | |
| 15 const request = new PresentationRequest('https://example.com'); | |
| 16 | |
| 17 waitForClick(_ => { | |
| 18 request.start().then(conn => { | |
| 19 connection = conn; | |
| 20 assert_not_equals(connection, null); | |
| 21 assert_equals(connection.state, 'connecting'); | |
| 22 | |
| 23 connection.onclose = (_ => { | |
| 24 assert_equals(connection.state, 'closed'); | |
| 25 request.reconnect(connection.id).then( | |
| 26 t.step_func_done(conn => { | |
| 27 assert_equals(connection, conn); | |
| 28 assert_equals(connection.state, 'connecting'); | |
| 29 }) | |
| 30 ); | |
| 31 }); | |
| 32 connection.close(); | |
| 33 }); | |
| 34 }, button); | |
| 35 }); | |
| 36 }, "Test that Presentation.reconnect() resolves with a previously closed present
ation connection, whose state is updated to 'connecting.'"); | |
| 37 | |
| 38 </script> | |
| 39 </body> | |
| 40 </html> | |
| OLD | NEW |