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