Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentation-reconnect.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-reconnect.html b/third_party/WebKit/LayoutTests/presentation/presentation-reconnect.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..152e84d415fd15dce16606fc3a2312ff6154fe95 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-reconnect.html |
| @@ -0,0 +1,49 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../resources/gc.js"></script> |
| +<script src="../resources/mojo-helpers.js"></script> |
| +<script src="resources/presentation-service-mock.js"></script> |
| +<button>click me</button> |
| +<script> |
| + |
| +function waitForClick(callback) { |
| + var button = document.querySelector('button'); |
| + button.addEventListener('click', callback, { once: true }); |
| + |
| + if (!('eventSender' in window)) |
| + return; |
| + |
| + var boundingRect = button.getBoundingClientRect(); |
| + var x = boundingRect.left + boundingRect.width / 2; |
| + var y = boundingRect.top + boundingRect.height / 2; |
| + |
| + eventSender.mouseMoveTo(x, y); |
| + eventSender.mouseDown(); |
| + eventSender.mouseUp(); |
| +} |
| + |
| +async_test(t => { |
| + presentationServiceMock.then(mockService => { |
| + var connection; |
|
mlamouri (slow - plz ping)
2017/01/03 12:02:11
= null;
zhaobin
2017/01/03 20:12:07
Done.
|
| + var request = new PresentationRequest('https://example.com'); |
| + |
| + waitForClick(_ => { |
| + request.start().then(conn => { |
| + connection = conn; |
| + assert_not_equals(connection, null); |
| + |
| + request.reconnect(connection.id).then( |
| + t.step_func_done(conn => { |
| + assert_true(connection === conn); |
| + })); |
| + }); |
| + }); |
| + }); |
| +}, "Test that Presentation.reconnect() resolves with existing presentation connection."); |
| + |
| +</script> |
| +</body> |
| +</html> |