Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html |
| diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html b/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b875b5824ba4bb844e4822df8aecc38e2134af0a |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html |
| @@ -0,0 +1,36 @@ |
| +<!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> |
| +<script> |
| + |
| +async_test(t => { |
| + internals.settings.setPresentationReceiver(true); |
| + t.add_cleanup(_ => { internals.settings.setPresentationReceiver(false); }); |
| + |
| + presentationServiceMock.then(mockService => { |
| + // Invoke mockService.setClient(). |
| + const receiver = navigator.presentation.receiver; |
| + |
| + // Make sure it is invoked after calling setClient(). |
| + setTimeout(() => { |
| + const url = 'http://example.com/a.html'; |
| + const id = 'fakeSessionId'; |
| + mockService.onReceiverConnectionAvailable(url, id); |
| + |
| + receiver.connectionList.then( |
| + t.step_func_done(list => { |
| + assert_equals(list.connections.length, 1); |
| + assert_equals(list.connections[0].url, url); |
| + assert_equals(list.connections[0].id, id); |
| + })); |
| + }); |
| + }); |
| +}, "Test presetnation.receiver.connectionList resolves with incoming connection."); |
|
imcheng
2017/02/21 23:53:16
s/presetnation/presentation
|
| + |
| +</script> |
| +</body> |
| +</html> |