Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html

Issue 2730123003: [Presentation API] Add layout test for connection.close() and fix test failures (Closed)
Patch Set: remove unnecessary forward declarations Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html
diff --git a/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html b/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html
new file mode 100644
index 0000000000000000000000000000000000000000..1bf738a981a222cab81da4baa5a19f0b533610d1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-close-connection.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/mojo-helpers.js"></script>
+<script src="presentation-service-mock.js"></script>
+<script>
+
+// Parent window sets parameter for this page.
+assert_not_equals(controllerConnectionPtr, null);
+assert_not_equals(receiverConnectionRequest, null);
+assert_not_equals(shouldCallClose, null);
+
+internals.settings.setPresentationReceiver(true);
+
+presentationServiceMock.then(mockService => {
+ const url = 'http://example.com/a.html';
+ const id = 'fakeSessionId';
+
+ mockService.onSetClient = () => {
+ mockService.onReceiverConnectionAvailable(
+ url, id, controllerConnectionPtr, receiverConnectionRequest);
+ };
+
+ navigator.presentation.receiver.connectionList.then(list => {
+ assert_equals(list.connections.length, 1);
+ const connection = list.connections[0];
+ connection.onclose = () => {
+ assert_equals(connection.state, 'closed');
+ opener.postMessage('receiver connection closed', '*');
+ };
+ opener.postMessage('receiver connection ready', '*');
+ if (shouldCallClose) {
+ connection.close();
+ }
+ });
+});
+
+window.onunload = () => {
+ internals.settings.setPresentationReceiver(false);
+};
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698