Title: [218795] trunk
Revision
218795
Author
[email protected]
Date
2017-06-25 11:06:06 -0700 (Sun, 25 Jun 2017)

Log Message

Remove use of mock webrtc backend factory at injected bundle reset time
https://bugs.webkit.org/show_bug.cgi?id=173817

Patch by Youenn Fablet <[email protected]> on 2017-06-25
Reviewed by Darin Adler.

Source/WebCore:

* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState): Resetting the peer connection backend.
* testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up
(WebCore::useRealRTCPeerConnectionFactory):
(WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
(WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
(WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
(WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
* testing/MockLibWebRTCPeerConnection.h:

LayoutTests:

Making some tests less flaky.

* TestExpectations:
* fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt:
* platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html:
* webrtc/audio-peer-connection-webaudio.html:
* webrtc/captureCanvas-webrtc.html:
* webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added.
* webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added.
* webrtc/datachannel/bufferedAmountLowThreshold-expected.txt:
* webrtc/datachannel/bufferedAmountLowThreshold.html:
* webrtc/routines.js:
* webrtc/video-replace-muted-track.html:
* webrtc/video-unmute.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (218794 => 218795)


--- trunk/LayoutTests/ChangeLog	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/ChangeLog	2017-06-25 18:06:06 UTC (rev 218795)
@@ -1,3 +1,25 @@
+2017-06-25  Youenn Fablet  <[email protected]>
+
+        Remove use of mock webrtc backend factory at injected bundle reset time
+        https://bugs.webkit.org/show_bug.cgi?id=173817
+
+        Reviewed by Darin Adler.
+
+        Making some tests less flaky.
+
+        * TestExpectations:
+        * fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt:
+        * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html:
+        * webrtc/audio-peer-connection-webaudio.html:
+        * webrtc/captureCanvas-webrtc.html:
+        * webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt: Added.
+        * webrtc/datachannel/bufferedAmountLowThreshold-default.html: Added.
+        * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt:
+        * webrtc/datachannel/bufferedAmountLowThreshold.html:
+        * webrtc/routines.js:
+        * webrtc/video-replace-muted-track.html:
+        * webrtc/video-unmute.html:
+
 2017-06-24  Joseph Pecoraro  <[email protected]>
 
         Remove Reflect.enumerate

Modified: trunk/LayoutTests/TestExpectations (218794 => 218795)


--- trunk/LayoutTests/TestExpectations	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/TestExpectations	2017-06-25 18:06:06 UTC (rev 218795)
@@ -770,6 +770,7 @@
 # Media Sessions is not yet enabled by default: ENABLE(MEDIA_SESSION)
 media/session [ Skip ]
 
+webrtc/datachannel/multiple-connections.html [ Slow ]
 webrtc/negotiatedneeded-event-addStream.html [ Pass Crash ]
 webrtc/video-replace-track.html [ Pass Failure ]
 webrtc/video-getParameters.html [ Failure ]

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt (218794 => 218795)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-media-setup-two-dialogs-expected.txt	2017-06-25 18:06:06 UTC (rev 218795)
@@ -21,14 +21,85 @@
 A: create offer
 A: got offer, set it as local description
 A: local offer set
-FAIL pcA.signalingState should be have-local-offer. Was stable.
-FAIL pcA.pendingLocalDescription is not an instance of RTCSessionDescription
+PASS pcA.signalingState is 'have-local-offer'
+PASS pcA.pendingLocalDescription is an instance of RTCSessionDescription
 PASS pcA.currentLocalDescription is null
 
 A: send offer to B
 A --- offer --> B
 B: got offer from A, set it as remote description
-FAIL Error in promise chain: TypeError: Argument 1 ('description') to RTCPeerConnection.setRemoteDescription must be an instance of RTCSessionDescription
+----------
+PASS B: got remote track event
+----------
+B: remote offer set
+PASS pcB.signalingState is 'have-remote-offer'
+PASS pcB.pendingRemoteDescription is an instance of RTCSessionDescription
+PASS pcB.currentRemoteDescription is null
+
+B: create answer (without local media)
+B: got answer, set it as local description
+B: local answer set
+PASS pcB.signalingState is 'stable'
+PASS pcB.pendingLocalDescription is null
+PASS pcB.currentLocalDescription is an instance of RTCSessionDescription
+PASS pcB.pendingRemoteDescription is null
+PASS pcB.currentRemoteDescription is an instance of RTCSessionDescription
+
+B: send answer to A
+A <-- answer -- B
+A: got answer from B, set it as remote description
+A: remote answer set
+PASS pcA.signalingState is 'stable'
+PASS pcA.pendingLocalDescription is null
+PASS pcA.currentLocalDescription is an instance of RTCSessionDescription
+PASS pcA.pendingRemoteDescription is null
+PASS pcA.currentRemoteDescription is an instance of RTCSessionDescription
+
+PASS First offer/answer dialog completed
+========================================
+
+PASS pcB.getSenders().length is 1
+B: add media (should reuse sender)
+PASS pcB.getSenders().length is 1
+B: create offer
+B: got offer, set it as local description
+B: local offer set (session update so we have both pending and current local descriptions)
+PASS pcB.signalingState is 'have-local-offer'
+PASS pcB.pendingLocalDescription is an instance of RTCSessionDescription
+PASS pcB.currentLocalDescription is an instance of RTCSessionDescription
+
+B: send offer to A
+A <-- offer --- B
+A: got offer from B, set it as remote description
+----------
+PASS A: got remote track event
+----------
+A: remote offer set (session update so we have both pending and current remote descriptions)
+PASS pcA.signalingState is 'have-remote-offer'
+PASS pcA.pendingRemoteDescription is an instance of RTCSessionDescription
+PASS pcA.currentRemoteDescription is an instance of RTCSessionDescription
+
+A: create answer
+A: got answer, set it as local description
+A: local answer set
+PASS pcA.signalingState is 'stable'
+PASS pcA.pendingLocalDescription is null
+PASS pcA.currentLocalDescription is an instance of RTCSessionDescription
+PASS pcA.pendingRemoteDescription is null
+PASS pcA.currentRemoteDescription is an instance of RTCSessionDescription
+
+A: send answer to B
+A --- answer -> B
+B: got answer from A, set it as remote description
+B: remote answer set
+PASS pcB.signalingState is 'stable'
+PASS pcB.pendingLocalDescription is null
+PASS pcB.currentLocalDescription is an instance of RTCSessionDescription
+PASS pcB.pendingRemoteDescription is null
+PASS pcB.currentRemoteDescription is an instance of RTCSessionDescription
+
+PASS Second offer/answer dialog completed
+
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html (218794 => 218795)


--- trunk/LayoutTests/platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -39,10 +39,10 @@
     if (isEqual === isSame)
         return;
 
-    if (count === 20)
+    if (count === 40)
         return Promise.reject(testName + " failed");
 
-    return waitFor(50).then(() => {
+    return waitFor(100).then(() => {
         return testCanvas(testName, array1, isSame, ++count);
     });
 }

Modified: trunk/LayoutTests/webrtc/audio-peer-connection-webaudio.html (218794 => 218795)


--- trunk/LayoutTests/webrtc/audio-peer-connection-webaudio.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/audio-peer-connection-webaudio.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -8,6 +8,30 @@
     <script src =""
     <script>
     var context = new webkitAudioContext();
+    var remoteStream;
+
+    async function checkForHumBipBop(stream, previousResults, counter)
+    {
+        if (!previousResults)
+            previousResults = {
+                heardHum : false,
+                heardBip : false,
+                heardBop : false
+        };
+        if (!counter)
+            counter = 1;
+        else if (++counter > 4)
+            return Promise.resolve(false);
+        results = await analyseAudio(stream, 1000, context);
+        previousResults.heardHum |= results.heardHum;
+        previousResults.heardBip |= results.heardBip;
+        previousResults.heardBop |= results.heardBop;
+        if (previousResults.heardHum && previousResults.heardBip && previousResults.heardBop)
+            return Promise.resolve(true);
+        var results = await checkForHumBipBop(stream, previousResults, counter);
+        return results;
+    }
+
     promise_test((test) => {
         if (window.testRunner)
             testRunner.setUserMediaPermission(true);
@@ -21,12 +45,10 @@
                 });
                 setTimeout(() => reject("Test timed out"), 5000);
             });
-        }).then((remoteStream) => {
-            return analyseAudio(remoteStream, 1000, context);
+        }).then((stream) => {
+            return checkForHumBipBop(stream);
         }).then((results) => {
-            assert_true(results.heardHum, "heard hum");
-            assert_true(results.heardBip, "heard bip");
-            assert_true(results.heardBop, "heard bop");
+            assert_true(results, "heard hum bip bop");
         }).then(() => {
             return context.close();
         });

Modified: trunk/LayoutTests/webrtc/captureCanvas-webrtc.html (218794 => 218795)


--- trunk/LayoutTests/webrtc/captureCanvas-webrtc.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/captureCanvas-webrtc.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -40,7 +40,7 @@
     if (count === 20)
         return Promise.reject(testName + " failed, expected " + JSON.stringify(array1) + " but got " + JSON.stringify(array2));
 
-    return waitFor(50).then(() => {
+    return waitFor(100).then(() => {
         return testCanvas(testName, array1, isSame, ++count);
     });
 }
@@ -89,9 +89,9 @@
 }, "Checking canvas is green again");
 
 promise_test((test) => {
-        canvas1.width = 640;
-        canvas1.height = 480;
-        return waitForVideoSize(video, 640, 480);
+    canvas1.width = 640;
+    canvas1.height = 480;
+    return waitForVideoSize(video, 640, 480);
 }, "Checking canvas size change");
         </script>
     </head>

Added: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt (0 => 218795)


--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default-expected.txt	2017-06-25 18:06:06 UTC (rev 218795)
@@ -0,0 +1,3 @@
+
+PASS Default buffer threshold 
+

Added: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default.html (0 => 218795)


--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default.html	                        (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-default.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>Testing bufferedAmountLowThreashold default RTCDataChannel attribute and event</title>
+    <script src=""
+    <script src=""
+  </head>
+  <body>
+    <script src =""
+    <script>
+window.addEventListener("unhandledrejection", event => {
+    event.preventDefault();
+});
+
+var localChannel;
+var remoteChannel;
+
+function closeDataChannels() {
+    localChannel.close();
+    remoteChannel.close();
+    closeConnections();
+}
+
+var longString = "abcdefgh";
+for (var cptr = 0; cptr < 14; ++cptr)
+    longString += longString;
+
+function sendMessages(channel)
+{
+    channel.send(longString);
+    channel.send(longString);
+    channel.send(longString);
+}
+
+function receiveMessages(event) {
+    if (++counter === 1)
+        return;
+}
+
+promise_test((test) => {
+    counter = 0;
+    var gotEvent = false;
+    return new Promise((resolve, reject) => {
+        createConnections((localConnection) => {
+            localChannel = localConnection.createDataChannel('sendDataChannel');
+            localChannel._onopen_ = () => { sendMessages(localChannel); };
+            localChannel._onbufferedamountlow_ = () => {
+                resolve();
+            }
+            assert_equals(localChannel.bufferedAmountLowThreshold, 0, "default bufferedAmountLowThreshold value");
+        }, (remoteConnection) => {
+            remoteConnection._ondatachannel_ = (event) => {
+                remoteChannel = event.channel;
+                remoteChannel._onmessage_ = receiveMessages;
+            };
+        });
+        setTimeout(() => reject('timed out'), 5000);
+    }).then (() => {
+        closeDataChannels();
+    });
+}, "Default buffer threshold");
+
+    </script>
+  </body>
+</html>

Modified: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt (218794 => 218795)


--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt	2017-06-25 18:06:06 UTC (rev 218795)
@@ -1,5 +1,4 @@
 
-PASS Default buffer threshold 
 PASS Large buffer threshold reached 
 PASS Medium buffer threshold not reached 
 

Modified: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html (218794 => 218795)


--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -26,41 +26,11 @@
 for (var cptr = 0; cptr < 14; ++cptr)
     longString += longString;
 
-function sendMessages(channel)
-{
-    channel.send(longString);
-    channel.send(longString);
-    channel.send(longString);
-}
-
 function receiveMessages(event) {
     if (++counter === 1)
         return;
 }
 
-promise_test((test) => {
-    counter = 0;
-    var gotEvent = false;
-    return new Promise((resolve, reject) => {
-        createConnections((localConnection) => {
-            localChannel = localConnection.createDataChannel('sendDataChannel');
-            localChannel._onopen_ = () => { sendMessages(localChannel); };
-            localChannel._onbufferedamountlow_ = () => {
-                resolve();
-            }
-            assert_equals(localChannel.bufferedAmountLowThreshold, 0, "default bufferedAmountLowThreshold value");
-        }, (remoteConnection) => {
-            remoteConnection._ondatachannel_ = (event) => {
-                remoteChannel = event.channel;
-                remoteChannel._onmessage_ = receiveMessages;
-            };
-        });
-        setTimeout(() => reject('timed out'), 5000);
-    }).then (() => {
-        closeDataChannels();
-    });
-}, "Default buffer threshold");
-
 function sendContinuouslyMessages(channel)
 {
     try {

Modified: trunk/LayoutTests/webrtc/routines.js (218794 => 218795)


--- trunk/LayoutTests/webrtc/routines.js	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/routines.js	2017-06-25 18:06:06 UTC (rev 218795)
@@ -144,7 +144,7 @@
     if (++count > 20)
         return Promise.reject("waitForVideoSize timed out, expected " + width + "x"+ height + " but got " + video.videoWidth + "x" + video.videoHeight);
 
-    return waitFor(50).then(() => {
+    return waitFor(100).then(() => {
         return waitForVideoSize(video, width, height, count);
     });
 }
@@ -152,10 +152,11 @@
 async function doHumAnalysis(stream, expected)
 {
     var context = new webkitAudioContext();
-    for (var cptr = 0; cptr < 10; cptr++) {
+    for (var cptr = 0; cptr < 20; cptr++) {
         var results = await analyseAudio(stream, 200, context);
         if (results.heardHum === expected)
             return true;
+        await waitFor(50);
     }
     await context.close();
     return false;

Modified: trunk/LayoutTests/webrtc/video-replace-muted-track.html (218794 => 218795)


--- trunk/LayoutTests/webrtc/video-replace-muted-track.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/video-replace-muted-track.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -32,7 +32,7 @@
 function pollVideoBlackCheck(expected, resolve, delay)
 {
     if (isVideoBlack() === expected || stopPolling) {
-        resolve();
+        resolve(true);
         return;
     }
 
@@ -39,13 +39,13 @@
     setTimeout(() => pollVideoBlackCheck(expected, resolve), delay);
 }
 
-function checkVideoBlack(expected, duration, id, delay)
+async function checkVideoBlack(expected, duration, id, delay)
 {
     stopPolling = false;
     return new Promise((resolve, reject) => {
         pollVideoBlackCheck(expected, resolve, delay);
         setTimeout(() => {
-            reject("checkVideoBlack timed out for " + id + ", expected " + expected);
+            resolve(false);
             stopPolling = true;
         }, duration);
     });
@@ -61,6 +61,15 @@
     return imageData.data;
 }
 
+async function checkForNoBlackFrames()
+{
+    for (var cptr = 0; cptr < 10; cptr++) {
+        if (!(await checkVideoBlack(true, 1500, "test3", 50)))
+            return true;
+    }
+    return false;
+}
+
 promise_test((test) => {
     if (window.testRunner)
         testRunner.setUserMediaPermission(true);
@@ -93,11 +102,14 @@
     }).then(() => {
         return waitFor(200);
     }).then(() => {
-        // Let's ensure we have some non black frames sent.
         return checkVideoBlack(false, 5000, "test2", 200);
+    }).then((result) => {
+        assert_true(result, "expect to receive some non black frames");
     }).then(() => {
-        // Let's ensure there are no black frames sent.
-        return checkVideoBlack(true, 2000, "test3", 50).then(assert_unreached, () => { });
+        // Let's ensure there are no black frames being received.
+        return checkForNoBlackFrames();
+    }).then((result) => {
+        assert_true(result, "check no black frame");
     });
 }, "Switching from disabled to enabled track");
         </script>

Modified: trunk/LayoutTests/webrtc/video-unmute.html (218794 => 218795)


--- trunk/LayoutTests/webrtc/video-unmute.html	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/LayoutTests/webrtc/video-unmute.html	2017-06-25 18:06:06 UTC (rev 218795)
@@ -40,7 +40,7 @@
 
     if (!counter)
         counter = 0;
-    else if (++counter > 20) {
+    else if (++counter > 40) {
         reject("test for " + id + " timed out");
         return;
     }
@@ -50,7 +50,7 @@
 function checkVideoBlack(expected, id)
 {
     return new Promise((resolve, reject) => {
-        pollVideoBlackCheck(expected, id, resolve);
+        pollVideoBlackCheck(expected, id, resolve, reject);
     });
 }
 

Modified: trunk/Source/WebCore/ChangeLog (218794 => 218795)


--- trunk/Source/WebCore/ChangeLog	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/Source/WebCore/ChangeLog	2017-06-25 18:06:06 UTC (rev 218795)
@@ -1,3 +1,20 @@
+2017-06-25  Youenn Fablet  <[email protected]>
+
+        Remove use of mock webrtc backend factory at injected bundle reset time
+        https://bugs.webkit.org/show_bug.cgi?id=173817
+
+        Reviewed by Darin Adler.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState): Resetting the peer connection backend.
+        * testing/MockLibWebRTCPeerConnection.cpp: Doing some clean-up
+        (WebCore::useRealRTCPeerConnectionFactory):
+        (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
+        (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
+        (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
+        (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
+        * testing/MockLibWebRTCPeerConnection.h:
+
 2017-06-25  Konstantin Tokarev  <[email protected]>
 
         Remove excessive headers from _javascript_Core

Modified: trunk/Source/WebCore/testing/Internals.cpp (218794 => 218795)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-06-25 18:06:06 UTC (rev 218795)
@@ -465,6 +465,10 @@
 #endif
 
     printContextForTesting() = nullptr;
+
+#if USE(LIBWEBRTC)
+    WebCore::useRealRTCPeerConnectionFactory();
+#endif
 }
 
 Internals::Internals(Document& document)

Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp (218794 => 218795)


--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp	2017-06-25 18:06:06 UTC (rev 218795)
@@ -47,6 +47,15 @@
     return getRealPeerConnectionFactory().get();
 }
 
+void useRealRTCPeerConnectionFactory()
+{
+    auto& factory = getRealPeerConnectionFactory();
+    if (!factory)
+        return;
+    LibWebRTCProvider::setPeerConnectionFactory(factory.get());
+    factory = nullptr;
+}
+
 void useMockRTCPeerConnectionFactory(LibWebRTCProvider* provider, const String& testCase)
 {
     if (provider && !realPeerConnectionFactory()) {
@@ -152,25 +161,10 @@
 MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory(String&& testCase)
     : m_testCase(WTFMove(testCase))
 {
-    if (m_testCase == "TwoRealPeerConnections") {
-        m_numberOfRealPeerConnections = 2;
-        return;
-    }
-    if (m_testCase == "OneRealPeerConnection")
-        m_numberOfRealPeerConnections = 1;
 }
 
-rtc::scoped_refptr<webrtc::PeerConnectionInterface> MockLibWebRTCPeerConnectionFactory::CreatePeerConnection(const webrtc::PeerConnectionInterface::RTCConfiguration& configuration, std::unique_ptr<cricket::PortAllocator> portAllocator, std::unique_ptr<rtc::RTCCertificateGeneratorInterface> generator, webrtc::PeerConnectionObserver* observer)
+rtc::scoped_refptr<webrtc::PeerConnectionInterface> MockLibWebRTCPeerConnectionFactory::CreatePeerConnection(const webrtc::PeerConnectionInterface::RTCConfiguration&, std::unique_ptr<cricket::PortAllocator>, std::unique_ptr<rtc::RTCCertificateGeneratorInterface>, webrtc::PeerConnectionObserver* observer)
 {
-    if (!realPeerConnectionFactory())
-        return nullptr;
-
-    if (m_numberOfRealPeerConnections) {
-        auto connection = realPeerConnectionFactory()->CreatePeerConnection(configuration, WTFMove(portAllocator), WTFMove(generator), observer);
-        --m_numberOfRealPeerConnections;
-        return connection;
-    }
-
     if (m_testCase == "ICECandidates")
         return new rtc::RefCountedObject<MockLibWebRTCPeerConnectionForIceCandidates>(*observer);
 
@@ -191,15 +185,11 @@
 
 rtc::scoped_refptr<webrtc::VideoTrackInterface> MockLibWebRTCPeerConnectionFactory::CreateVideoTrack(const std::string& id, webrtc::VideoTrackSourceInterface* source)
 {
-    if (m_testCase == "TwoRealPeerConnections")
-        return realPeerConnectionFactory()->CreateVideoTrack(id, source);
     return new rtc::RefCountedObject<MockLibWebRTCVideoTrack>(id, source);
 }
 
 rtc::scoped_refptr<webrtc::AudioTrackInterface> MockLibWebRTCPeerConnectionFactory::CreateAudioTrack(const std::string& id, webrtc::AudioSourceInterface* source)
 {
-    if (m_testCase == "TwoRealPeerConnections")
-        return realPeerConnectionFactory()->CreateAudioTrack(id, source);
     return new rtc::RefCountedObject<MockLibWebRTCAudioTrack>(id, source);
 }
 

Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h (218794 => 218795)


--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h	2017-06-25 17:40:30 UTC (rev 218794)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.h	2017-06-25 18:06:06 UTC (rev 218795)
@@ -37,6 +37,7 @@
 class MockRtpSender;
 
 void useMockRTCPeerConnectionFactory(LibWebRTCProvider*, const String&);
+void useRealRTCPeerConnectionFactory();
 
 class MockLibWebRTCPeerConnection : public webrtc::PeerConnectionInterface {
 public:
@@ -256,7 +257,6 @@
 
 private:
     String m_testCase;
-    unsigned m_numberOfRealPeerConnections { 0 };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to