| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script> |
| <script src="file:///gen/third_party/WebKit/public/platform/modules/presentation/presentation.mojom.js"></script> |
| <script src="resources/presentation-service-mock.js"></script> |
| <button>click me</button> |
| <script> |
| |
| var button = document.querySelector('button'); |
| |
| var testPresentationRequestStart = function(t, requestArgument, connectionUrl) { |
| // This is receiving the user gesture and runs the callback. |
| waitForClick(() => { |
| new PresentationRequest(requestArgument).start().then( |
| t.step_func_done(connection => { |
| assert_equals(connection.url, connectionUrl); |
| assert_equals(connection.state, 'connecting'); |
| })); |
| }, button); |
| }; |
| |
| async_test(t => { |
| var presentationUrl = "http://example.com/example.html"; |
| testPresentationRequestStart(t, presentationUrl, presentationUrl); |
| }, "Test that the PresentationRequest.start() with single URL resolves with correct PresentationConnection object."); |
| |
| async_test(t => { |
| var presentationUrls = ["http://example.com/example.html", "cast://google.com/app_id=deadbeef"]; |
| testPresentationRequestStart(t, presentationUrls, presentationUrls[0]); |
| }, "Test that the PresentationRequest.start() with multiple URLs resolves with correct PresentationConnection object."); |
| |
| async_test(t => { |
| var presentationUrl = "http://example.com/\ud801/example.html"; |
| var connectionUrl = "http://example.com/" + encodeURIComponent('\ufffd') + "/example.html" |
| |
| testPresentationRequestStart(t, presentationUrl, connectionUrl); |
| }, "Test that the PresentationRequest.start() with single URL containing special symbol resolves with correct PresentationConnection object."); |
| |
| </script> |
| </body> |
| </html> |