| OLD | NEW |
| 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/mojo-helpers.js"></script> | 6 <script src="../resources/mojo-helpers.js"></script> |
| 7 <script src="resources/presentation-service-mock.js"></script> | 7 <script src="resources/presentation-service-mock.js"></script> |
| 8 <button>click me</button> | 8 <button>click me</button> |
| 9 <script> | 9 <script> |
| 10 | 10 |
| 11 var button = document.querySelector('button'); | 11 var button = document.querySelector('button'); |
| 12 | 12 |
| 13 var testPresentationRequestStart = function(t, requestArgument, connectionUrl) { | 13 var testPresentationRequestStart = function(t, requestArgument, connectionUrl) { |
| 14 presentationServiceMock.then(t.step_func(service => { | 14 presentationServiceMock.then(service => { |
| 15 // This is receiving the user gesture and runs the callback. | 15 // This is receiving the user gesture and runs the callback. |
| 16 waitForClick(t.step_func(_ => { | 16 waitForClick(() => { |
| 17 new PresentationRequest(requestArgument).start().then( | 17 new PresentationRequest(requestArgument).start().then( |
| 18 t.step_func_done(connection => { | 18 t.step_func_done(connection => { |
| 19 assert_equals(connection.url, connectionUrl); | 19 assert_equals(connection.url, connectionUrl); |
| 20 })); | 20 })); |
| 21 }), button); | 21 }, button); |
| 22 })); | 22 }); |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 async_test(t => { | 25 async_test(t => { |
| 26 var presentationUrl = "http://example.com/example.html"; | 26 var presentationUrl = "http://example.com/example.html"; |
| 27 testPresentationRequestStart(t, presentationUrl, presentationUrl); | 27 testPresentationRequestStart(t, presentationUrl, presentationUrl); |
| 28 }, "Test that the PresentationRequest.start() with single URL resolves with corr
ect PresentationConnection object."); | 28 }, "Test that the PresentationRequest.start() with single URL resolves with corr
ect PresentationConnection object."); |
| 29 | 29 |
| 30 async_test(t => { | 30 async_test(t => { |
| 31 var presentationUrls = ["http://example.com/example.html", "cast://google.com/
app_id=deadbeef"]; | 31 var presentationUrls = ["http://example.com/example.html", "cast://google.com/
app_id=deadbeef"]; |
| 32 testPresentationRequestStart(t, presentationUrls, presentationUrls[0]); | 32 testPresentationRequestStart(t, presentationUrls, presentationUrls[0]); |
| 33 }, "Test that the PresentationRequest.start() with multiple URLs resolves with c
orrect PresentationConnection object."); | 33 }, "Test that the PresentationRequest.start() with multiple URLs resolves with c
orrect PresentationConnection object."); |
| 34 | 34 |
| 35 async_test(t => { | 35 async_test(t => { |
| 36 var presentationUrl = "http://example.com/\ud801/example.html"; | 36 var presentationUrl = "http://example.com/\ud801/example.html"; |
| 37 var connectionUrl = "http://example.com/" + encodeURIComponent('\ufffd') + "/e
xample.html" | 37 var connectionUrl = "http://example.com/" + encodeURIComponent('\ufffd') + "/e
xample.html" |
| 38 | 38 |
| 39 testPresentationRequestStart(t, presentationUrl, connectionUrl); | 39 testPresentationRequestStart(t, presentationUrl, connectionUrl); |
| 40 }, "Test that the PresentationRequest.start() with single URL containing special
symbol resolves with correct PresentationConnection object."); | 40 }, "Test that the PresentationRequest.start() with single URL containing special
symbol resolves with correct PresentationConnection object."); |
| 41 | 41 |
| 42 </script> | 42 </script> |
| 43 </body> | 43 </body> |
| 44 </html> | 44 </html> |
| OLD | NEW |