Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentation-start.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-start.html b/third_party/WebKit/LayoutTests/presentation/presentation-start.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f824eab2de8c8870b2d74e1e1e9dc1fe236c63f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-start.html |
| @@ -0,0 +1,44 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../resources/mojo-helpers.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) { |
| + presentationServiceMock.then(t.step_func(service => { |
| + // This is receiving the user gesture and runs the callback. |
| + waitForClick(t.step_func(_ => { |
| + new PresentationRequest(requestArgument).start().then( |
| + t.step_func_done(connection => { |
| + assert_equals(connection.url, connectionUrl); |
| + })); |
| + }), 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" |
|
foolip
2017/01/16 12:01:13
Nice, thanks for the test!
|
| + |
| + testPresentationRequestStart(t, presentationUrl, connectionUrl); |
| +}, "Test that the PresentationRequest.start() with single URL containing special symbol resolves with correct PresentationConnection object."); |
| + |
| +</script> |
| +</body> |
| +</html> |