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

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

Issue 2643473002: [Presentation API] Allow PresentationConnection state change to "Connecting" (Closed)
Patch Set: Address Mark and Bin's comments 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
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..4c60a85b14c0bf71c98942ca2b0dafd643986c10
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-close-reconnect.html
@@ -0,0 +1,40 @@
+<!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>
+
+async_test(t => {
+ presentationServiceMock.then(mockService => {
+ const button = document.querySelector('button');
+ let connection = null;
+ const 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_equals(connection.state, 'connecting');
+ })
+ );
+ });
+ connection.close();
+ });
+ }, button);
+ });
+}, "Test that Presentation.reconnect() resolves with a previously closed presentation connection, whose state is updated to 'connecting.'");
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698