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..bf12e3ef3eae721f79df61bbe655e90faf0a0253 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/presentation/presentation-onreceiverconnection.html |
| @@ -0,0 +1,38 @@ |
| +<!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(). |
| + var receiver = navigator.presentation.receiver; |
|
mark a. foltz
2017/02/21 17:47:38
s/var/const/
zhaobin
2017/02/21 19:11:38
Done.
|
| + |
| + // Make sure it is invoked after calling setClient(). |
| + setTimeout(() => { |
|
mark a. foltz
2017/02/21 17:47:38
Does the rest of the test need to be in an event h
zhaobin
2017/02/21 19:11:38
Yes, put them in an event handler to make sure thi
|
| + 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); |
| + list.connections.map(connection => { |
|
mark a. foltz
2017/02/21 17:47:38
Since the length is 1, you could just write
asser
zhaobin
2017/02/21 19:11:38
Done.
|
| + assert_equals(connection.url, url); |
| + assert_equals(connection.id, id); |
| + }); |
| + })); |
| + }); |
| + }); |
| +}, "Test presetnation.receiver.connectionList resolves with incoming connection."); |
| + |
| +</script> |
| +</body> |
| +</html> |