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

Unified Diff: third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Add an assertion for state change to closed Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html
diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html b/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html
new file mode 100644
index 0000000000000000000000000000000000000000..6be1487b4d9e1156936d29f03c9192f6bf35ca1c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html
@@ -0,0 +1,56 @@
+<!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>
+<button>click me</button>
+<script>
+
+function waitForClick(callback) {
+ var button = document.querySelector('button');
+ button.addEventListener('click', callback, { once: true });
+
+ if (!('eventSender' in window))
+ return;
+
+ var boundingRect = button.getBoundingClientRect();
+ var x = boundingRect.left + boundingRect.width / 2;
+ var y = boundingRect.top + boundingRect.height / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+async_test(t => {
+ presentationServiceMock.then(mockService => {
+ var connection = null;
+ var request = new PresentationRequest('https://example.com');
+
+ waitForClick(_ => {
+ request.start().then(conn => {
+ connection = conn;
+ assert_not_equals(connection, null);
+ assert_equals(connection.state, 'connecting');
+
+ connection.onclose = (_ => {
+ assert_equals(connection.state, 'closed');
+ request.reconnect(connection.id).then(
+ t.step_func_done(conn => {
+ assert_equals(connection, conn);
+ assert_true(connection.state === 'connecting' ||
mark a. foltz 2017/01/18 20:30:17 Shouldn't state always be 'connecting' in the reso
takumif 2017/01/18 20:53:22 I wasn't sure because there was a browser test [1]
zhaobin 2017/01/20 19:27:50 Adding 'connected' state to fix crbug.com/664629
takumif 2017/01/23 19:58:12 Is the browser test still flaky after https://code
+ connection.state === 'connected');
+ })
+ );
+ });
+ connection.close();
+ });
+ });
+ });
+}, "Test that Presentation.reconnect() resolves with a closed presentation connection and updates its state.");
mark a. foltz 2017/01/18 20:30:17 s/closed/connecting/
takumif 2017/01/18 20:53:22 I wanted to say that the connection given is the o
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/presentation/resources/presentation-service-mock.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698