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

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

Issue 2484273003: [Presentation API] (1-UA) fire PresentationConnection onterminate event if receiver page gets destr… (Closed)
Patch Set: rebase Created 3 years, 10 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-postmessage.html
diff --git a/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-postmessage.html b/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-postmessage.html
new file mode 100644
index 0000000000000000000000000000000000000000..72bd6992132575b7f9bbd6047f3f07c35cec0f0b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/resources/presentation-receiver-postmessage.html
@@ -0,0 +1,39 @@
+<!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>
+
+internals.settings.setPresentationReceiver(true);
+
+var connection = null;
+
+presentationServiceMock.then(mockService => {
+ const url = 'http://example.com/a.html';
+ const id = 'fakeSessionId';
+
+ mockService.onSetClient = () => {
+ mockService.onReceiverConnectionAvailable(url, id);
+ };
+
+ navigator.presentation.receiver.connectionList.then(list => {
+ assert_equals(list.connections.length, 1);
+ connection = list.connections[0];
+ connection.terminate();
+ });
+});
+
+window.onunload = () => {
+ if (connection.state == 'terminated') {
+ opener.postMessage('passed', '*');
+ } else {
+ opener.postMessage('failed', '*');
+ }
+ internals.settings.setPresentationReceiver(false);
+};
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698