Add a test for multi data channel peer connection
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jun 2017 22:49:41 +0000 (22:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jun 2017 22:49:41 +0000 (22:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173735

Patch by Youenn Fablet <youenn@apple.com> on 2017-06-22
Reviewed by Eric Carlson.

* webrtc/datachannel/multi-channel-expected.txt: Added.
* webrtc/datachannel/multi-channel.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/webrtc/datachannel/multi-channel-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/datachannel/multi-channel.html [new file with mode: 0644]

index 07bee4b..da0090a 100644 (file)
@@ -1,3 +1,13 @@
+2017-06-22  Youenn Fablet  <youenn@apple.com>
+
+        Add a test for multi data channel peer connection
+        https://bugs.webkit.org/show_bug.cgi?id=173735
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/datachannel/multi-channel-expected.txt: Added.
+        * webrtc/datachannel/multi-channel.html: Added.
+
 2017-06-22  Antoine Quint  <graouts@apple.com>
 
         REGRESSION: LayoutTest media/modern-media-controls/placard-support/placard-support-pip.html is a flaky timeout on Sierra
diff --git a/LayoutTests/webrtc/datachannel/multi-channel-expected.txt b/LayoutTests/webrtc/datachannel/multi-channel-expected.txt
new file mode 100644 (file)
index 0000000..f861a19
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Using two data channels in the same peer connection 
+
diff --git a/LayoutTests/webrtc/datachannel/multi-channel.html b/LayoutTests/webrtc/datachannel/multi-channel.html
new file mode 100644 (file)
index 0000000..21a6508
--- /dev/null
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Testing two data channels in the same peer connection</title>
+    <script src="../../resources/testharness.js"></script>
+    <script src="../../resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <script src ="../routines.js"></script>
+    <script>
+var counter = 0;
+function receiveMessages(event) {
+    if (++counter === 4)
+        finishTest();
+}
+
+function sendMessages1(channel)
+{
+    channel.send("one");
+    channel.send("two");
+}
+
+function sendMessages2(channel)
+{
+    channel.send("three");
+    channel.send("four");
+}
+
+var finishTest;
+promise_test((test) => {
+    counter = 0;
+    return new Promise((resolve, reject) => {
+        finishTest = resolve;
+        createConnections((localConnection) => {
+            var localChannel1 = localConnection.createDataChannel('channel1');
+            var localChannel2 = localConnection.createDataChannel('channel2');
+            localChannel1.onopen = () => { sendMessages1(localChannel1); };
+            localChannel2.onopen = () => { sendMessages2(localChannel2); };
+        }, (remoteConnection) => {
+            remoteConnection.ondatachannel = (event) => {
+                event.channel.onmessage = receiveMessages;
+            };
+        });
+        setTimeout(() => { reject("Test timed out"); }, 5000);
+    });
+}, "Using two data channels in the same peer connection");
+
+    </script>
+  </body>
+</html>