Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html b/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6be1487b4d9e1156936d29f03c9192f6bf35ca1c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html |
| @@ -0,0 +1,56 @@ |
| +<!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> |
| + |
| +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 = null; |
| + var request = new PresentationRequest('https://example.com'); |
| + |
| + waitForClick(_ => { |
| + request.start().then(conn => { |
| + connection = conn; |
| + assert_not_equals(connection, null); |
| + assert_equals(connection.state, 'connecting'); |
| + |
| + connection.onclose = (_ => { |
| + assert_equals(connection.state, 'closed'); |
| + request.reconnect(connection.id).then( |
| + t.step_func_done(conn => { |
| + assert_equals(connection, conn); |
| + assert_true(connection.state === 'connecting' || |
|
mark a. foltz
2017/01/18 20:30:17
Shouldn't state always be 'connecting' in the reso
takumif
2017/01/18 20:53:22
I wasn't sure because there was a browser test [1]
zhaobin
2017/01/20 19:27:50
Adding 'connected' state to fix crbug.com/664629
takumif
2017/01/23 19:58:12
Is the browser test still flaky after https://code
|
| + connection.state === 'connected'); |
| + }) |
| + ); |
| + }); |
| + connection.close(); |
| + }); |
| + }); |
| + }); |
| +}, "Test that Presentation.reconnect() resolves with a closed presentation connection and updates its state."); |
|
mark a. foltz
2017/01/18 20:30:17
s/closed/connecting/
takumif
2017/01/18 20:53:22
I wanted to say that the connection given is the o
|
| + |
| +</script> |
| +</body> |
| +</html> |