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

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

Issue 2863903002: [Presentation API] Change controller connection to 'terminated' when receiver connection terminates (Closed)
Patch Set: fix layout test failures Created 3 years, 7 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/presentation-receiver-terminate-connection.html
diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html b/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
index 55077a988f631c5c7b6cb7f3de4ae702909969db..3d462d477c7eaca1af42ee093386dda59fda77f9 100644
--- a/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-receiver-terminate-connection.html
@@ -3,13 +3,40 @@
<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>
+var button = document.querySelector('button');
+var controllerConnectionTerminated = false;
+
async_test(t => {
- const w = window.open("resources/presentation-receiver-postmessage.html");
+ presentationServiceMock.then(service => {
+ // This is receiving the user gesture and runs the callback.
+ waitForClick(() => {
+ new PresentationRequest("https://example.com/").start().then(
+ connection => {
+ connection.onterminate = () => {
+ assert_equals(connection.state, "terminated");
+ controllerConnectionTerminated = true;
+ };
+ connection.onconnect = () => {
+ // Open a receiver page and pass controller connection's
+ // controllerConnectionPtr and receiverConnectionRequest to it.
+ var w = window.open(
+ "resources/presentation-receiver-postmessage.html");
+ w.controllerConnectionPtr = service.getControllerConnectionPtr();
+ w.receiverConnectionRequest = service.getReceiverConnectionRequest();
+ };
+ });
+ }, button);
+ });
+
window.addEventListener("message", t.step_func(e => {
if (e.data == "passed" || e.data == "failed") {
assert_equals("passed", e.data, "Receiver connection is terminated!");
+ assert_true(controllerConnectionTerminated);
t.done();
}
}));

Powered by Google App Engine
This is Rietveld 408576698